FFI, DLL Linking, Windows Haskell Platform 2010
Nabil Alsharif
blit32 at gmail.com
Tue Mar 29 18:28:04 CEST 2011
Hi Everybody,
So, like every one else on this list, I have a C library that I would
like to access form Haskell. I am in the process of writing a Haskell
interface for the distorm3 disassembler. The library was compiled into
a DLL using MSVC. Because this is the first I've used FFI I'm keeping
it simple and there is only one function I import Ala:
foreign import ccall "distorm.h distorm_version"
c_distorm_version :: IO (CUInt)
The issue is when I try to compile the library the linker goes haywire:
C:\Users\tantalum\Documents\Research\distorm_test>ghc --make Main.hs
[2 of 2] Compiling Main ( Main.hs, Main.o )
Linking Main.exe ...
.\Distorm3.o:fake:(.text+0x11b): undefined reference to `distorm_version'
collect2: ld returned 1 exit status
C:\Users\tantalum\Documents\Research\distorm_test>ghc --make Main.hs -l distorm3
Linking Main.exe ...
C:\Program Files (x86)\Haskell Platform\2010.2.0.0\mingw\bin\ld.exe: cannot find
-lC:\Users\tantalum\AppData\Local\Temp\ghc5976_0\ghc5976_0.o
collect2: ld returned 1 exit status
Any ideas or suggestions? What is that temporary object file for?
Thanks in advance for any help. Hope you all are having a good day.
Nabil Alsharif.
More information about the FFI
mailing list