Problems creating Haskell-dll without -fvia-C

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Problems creating Haskell-dll without -fvia-C


I recently read a haskell-cafe-thread telling me that the compiler option -fvia-C
will be removed. This gets me a bit worried...

I use -fvia-C when I build my haskell dll, and it works just fine (Haskell 2010.2.0.0):

ghc -c Adder.hs -O2 -fvia-C
ghc -c StartEnd.c
ghc -shared -o Adder.dll Adder.o Adder_stub.o StartEnd.o Adder.def
Next I create a lib which can be imported in Visual C++:

lib /machine:i386 /def:SingThing.def

BUT...if I remove the flag -fvia-C, the program crashes when I run it:(

I've tried experimenting with a few things:

*  Haskell FFI's calling conventions ccall/stdcall

*  Skipping the .def file

*  Skipping "lib /machine:i386 /def:SingThing.def", instead trying the approach descibed in:


Can anyone please give me a hint of whats going on?

I guess it must be somthing with pointers and calling conventions, but I'm banging my head against the wall now:(

Cheers Klas

(Btw... I should mention that the simple Adder.hs example actually works without -fvia-C, my
 dll is more advanced, but I'm following the same compiling procedure)