Linking C library with haskell in Windows

Hi all, I created Haskell Bindings to the NetCDF Library on linux and everything works well, bute when trying to ported to windows, I keep receiving undefined references when linking. I changed the stdcall on the FFI's, played with the cabal file to link to different libraries, both built on VC and MinGW but still can't find the solution Linking Test.exe ... .\NetCDFRaw.o:fake:(.text+0x2eb): undefined reference to `nc_create@12' .\NetCDFRaw.o:fake:(.text+0x45f): undefined reference to `nc_open@12' .\NetCDFRaw.o:fake:(.text+0x5e5): undefined reference to `nc_def_dim@16' .\NetCDFRaw.o:fake:(.text+0x787): undefined reference to `nc_inq_dimid@12' .\NetCDFRaw.o:fake:(.text+0x92e): undefined reference to `nc_def_var@24' .\NetCDFRaw.o:fake:(.text+0xb35): undefined reference to `nc_put_att_text@16' .\NetCDFRaw.o:fake:(.text+0xd0a): undefined reference to `nc_put_att_int@24' .\NetCDFRaw.o:fake:(.text+0xf32): undefined reference to `nc_put_att_double@24' .\NetCDFRaw.o:fake:(.text+0x1148): undefined reference to `nc_inq@20' .\NetCDFRaw.o:fake:(.text+0x130e): undefined reference to `nc_inq_ndims@8' Is there something I am missing? kotshie

I don't think changing the calling convention in the binding source
code is a good idea.
If you can build the original C library with MinGW it should have the
same calling convention as Linux. WinAPI uses stdcall and possibly
DLLs compiled with VC do (tip - don't use VC DLLs if you don't have
to), but otherwise you should be using ccall.
On 26 May 2012 19:48, kotshie
I changed the stdcall on the FFI's, played with the cabal file to link to different libraries, both built on VC and MinGW but still can't find the solution

Thanks, its now solved, the problem was library conflicts with a cygwin workspaces working along with MinGW.. Deleted cygwin and rebuild from mingw and everything is working now. On 05/27/2012 02:12 AM, Stephen Tetley wrote:
I don't think changing the calling convention in the binding source code is a good idea.
If you can build the original C library with MinGW it should have the same calling convention as Linux. WinAPI uses stdcall and possibly DLLs compiled with VC do (tip - don't use VC DLLs if you don't have to), but otherwise you should be using ccall.
On 26 May 2012 19:48, kotshie
wrote: I changed the stdcall on the FFI's, played with the cabal file to link to different libraries, both built on VC and MinGW but still can't find the solution
participants (2)
-
kotshie
-
Stephen Tetley