GHC 6.4.1 and Win32 DLLs: Bug in shutdownHaskell?

Cyril Schmidt cschmidt at deds.nl
Fri Mar 3 10:26:33 EST 2006


Michael,

Sorry, I might have had wrong assumptions about what you want to do.

I presume you have a C++ application compiled via Visual Studio 6
that invokes a Haskell DLL. If that's correct, read on; if not,
please tell me again what your setting is.

To link your Haskell DLL with the C++ application:

1. Create a .def file for your DLL.  Say, your Haskell library
   is HaskellLib.dll, so your .def file will be HaskelLib.def.
   Suppose the Haskell finction that you want to call from C++ is
   myHaskellFunc, then the .def file might look like

LIBRARY HASKELLLIB
EXPORTS
    myHaskellFunc

2. Create an import library using Visual Studio's lib.exe:

lib /DEF:HaskellLib.def /OUT:HaskellLib.lib

3. Add HaskellLib.lib to your Visual Studio project and link.

Cheers,

Cyril

> Cyril,
>
> I know the Haskell Wiki page you pointed to; it does not answer my
> specific questions.
>
> The decision which compiler to use is not up to me and, as the Wiki page
> points out, there is no other way to use Haskell modules from within a
> Visual Studio C++ compiled application than via a DLL:
>
> "The Windows distribution of GHC comes bundled with the GCC compiler,
> which is used as backend. That's why linking Haskell with Visual C++ is
> no different from linking GCC-generated code with the code generated by
> Visual C++.
>
> One cannot statically link together object files produced by those two
> compilers, but they can be linked dynamically: an executable produced by
> Visual C++ can invoke a DLL produced by GCC, and vice versa."
>
> Michael
>
>



More information about the Glasgow-haskell-users mailing list