
Cyril Schmidt wrote:
I am far from being an expert, but I have seen no answer to your question so far, so I'll tell how I'd do it (however ugly that might be). I don't have a sample project, but it should be fairly easy to make it.
1. Make a DLL project in Visual Studio. VS will create a .vcproj and .sln files for you. Add your C++ source files to this project.
2. Create a .def file for your DLL. It might look like LIBRARY MyDLL EXPORTS function1 function2
where function1 and function2 are the names of the C++ functions that you want to invoke from Haskell (there can be more of them, of course), MyDLL is the name of your DLL.
3. Create an import library that can be used by ghc: dlltool -d MyDLL.def -l libMyDLL.a
Thanks. The only problem is that dlltool doesn't work because I don't have cygwin installed. (I just downloaded dlltool.exe from somewhere on the web) I really don't want to install cygwin if at all possible because I'm trying to keep my system as close as possible to an end-user's system ie just winXP and nothing else (except VS and GHC) - is there a version of dlltool that can just run by itself? Regards, Brian.