Calling ghc dll's with MSVC++ code

Mauricio Carvalho m.decarvalho@telia.com
Tue, 3 Dec 2002 15:13:28 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0020_01C29ADE.884D9C00
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hey!
I need to call haskell DLL's from a c++ program, and this C++ is written =
in Microsoft's Visual C++ 6.0
I created the DLL sing the directives given at ghc user's  guide (11.3 =
and 11.4) and created the dll. To create a .lib import file, I linked =
with the option=20
-optdll--output-lib -optdllMyDll.lib
I can compile and link my C++ problem, but when I run it, it crashes.
I tried even to create a DLL from a C source I'm sure it works (as I =
created the DLL before with MSVC++ environment, and I could make it work =
out), and even this DLL crashes whe its functions are accessed.
I'm using GHC 5.0.4.1
Is there some special command lines that must be used to create DLLs to =
be used with windows? Or is there some known difficulty doing it?
Someone that succeded can please tell me exactly how was it done?
If more info is needed, I can send the sources and command lines I used =
to compile.
ps: I'm not using cygwin (i don't have it installed in my computer =
actually), but as far as I understood, it shouldn't be a problem
=B4Thanks for help!
Mauricio

------=_NextPart_000_0020_01C29ADE.884D9C00
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2716.2200" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hey!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I need to call haskell DLL's from a c++ =
program,=20
and this C++ is written in Microsoft's Visual C++ 6.0</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I created the DLL sing the directives =
given at ghc=20
user's&nbsp; guide (11.3 and 11.4) and created the dll. To create a .lib =
import=20
file, I linked with the option </FONT></DIV>
<DIV><FONT face=3DArial size=3D2><EM>-optdll--output-lib=20
-optdllMyDll.lib</EM></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I can compile and link my C++ problem, =
but when I=20
run it, it crashes.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I tried even&nbsp;to create a DLL from =
a C source=20
I'm sure it works (as I created the DLL before with MSVC++ environment, =
and I=20
could make it work out), and even this DLL crashes whe its functions are =

accessed.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm using GHC 5.0.4.1</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Is there some special command lines =
that must be=20
used to create DLLs to be used with windows? Or is there some known =
difficulty=20
doing it?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Someone that succeded can please tell =
me exactly=20
how was it done?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>If more info is needed, I can send the =
sources and=20
command lines I used to compile.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ps: I'm not using cygwin (i don't have =
it installed=20
in my computer actually), but as far as I understood, it shouldn't be a=20
problem</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>=B4Thanks for help!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Mauricio</FONT></DIV></BODY></HTML>

------=_NextPart_000_0020_01C29ADE.884D9C00--