FFI imported function names

Hello How is decided whether the name of imported function gets the ending of the form @4 in ghc? I'm having this problem on Windows trying to use HSQL MySQL on windows. I compile HSQL Oracle backend and I get names without that. It's ok. With HSQL MySQL I get names with that stuff. It prevents me from further linking to dll. Supplying in the ghc command-line the "lib" file where names have those marks doesn't have any effect. The linker says that fname@NN cannot be resolved. Can I control that? The ffi calling convention doesn't (and shouldn't as I understand) affect this. The only difference is that in the case of mysql the header file itself where functions are described marks it STDCALL. Is that the reason? Also I changed ffi import line from "hsmysql.h func" to just "func", to no avail. ghc 6.8.2 I'm lost. Please help. -- Daniil Elovkov

Mm, actually I didn't change the calling convention ffi imports when I
thought I did. I tried to do it through defines...
Well, by explicitly saying ccall I get the names without @<n>
decoration. And it all links well. But I get segault when I run the
code, which should mean that calling conventions didn't match.
Actually I found some ramblings on the internet that there's something
wrong with libmysql.dll and libmysql.lib in this respect, but they
were from 2004.
Thus the question: how do I link against a lib file in ghc? When I say
-lmysql on command line it strictly searches for dll and complains if
it's not found. Adding lib exlpicitly on the cmd line doesn't seem to
have any effect.
Thanks
2008/12/24 Daniil Elovkov
Hello
How is decided whether the name of imported function gets the ending of the form @4 in ghc?
I'm having this problem on Windows trying to use HSQL MySQL on windows.
I compile HSQL Oracle backend and I get names without that. It's ok. With HSQL MySQL I get names with that stuff. It prevents me from further linking to dll. Supplying in the ghc command-line the "lib" file where names have those marks doesn't have any effect.
The linker says that fname@NN cannot be resolved.
Can I control that?
The ffi calling convention doesn't (and shouldn't as I understand) affect this. The only difference is that in the case of mysql the header file itself where functions are described marks it STDCALL. Is that the reason?
Also I changed ffi import line from "hsmysql.h func" to just "func", to no avail.
ghc 6.8.2
I'm lost. Please help.
-- Daniil Elovkov
-- Daniil Elovkov
participants (1)
-
Daniil Elovkov