[Haskell-cafe] Linking to third party libraries in windows

SevenThunders mattcbro at earthlink.net
Thu May 25 12:34:28 EDT 2006


Has anyone actually seen ghc link successfully to third party libraries on
windows?
While I have been able to link to C object code compiled by ghc (and thus
gcc by proxy), I have not been able to actually link against any substantial
third party library or dll in windows.

I am currently attempting to link to an amd linear algebra library that was
compiled, in fact via gcc (libacml.a) .  As soon as I include the following
statement in my haskell code

foreign import ccall "acml.h daxpy" daxpy:: CInt -> CDouble -> Ptr CDouble
-> CInt -> Ptr CDouble -> CInt -> IO ()

and then link against the acml library using ghc via flags of the form
ghc -O2  -fglasgow-exts main.hs  -L. -llibacml

my executable becomes a "do nothing" routine.  That is inclusion of the
foreign import prevents any output from occurring even though it compiles
just fine.  In fact this happens even if I don't use daxpy in the code. 
Removal of the foreign import allows the program to run.  The same problem
occurs whether or not I'm linking against a static library or a library
providing stubs for a .dll.
--
View this message in context: http://www.nabble.com/Linking+to+third+party+libraries+in+windows-t1681736.html#a4561003
Sent from the Haskell - Haskell-Cafe forum at Nabble.com.



More information about the Haskell-Cafe mailing list