Aha! I should have known - I wrote an external library interface creator for the Rebol language and I extracted mangled function names from the DLL there. I am just using a hex editor to examine the end of the DLL file manually.
I found that this works when I type it in the listener: USING: kernel alien ; IN: fmod "fmod" "Anton/fmod.dll" "stdcall" add-library : FSOUND_GetVersion "float" "fmod" "[EMAIL PROTECTED]" { } alien-invoke ; USE: compiler \ FSOUND_GetVersion compile ! test FSOUND_GetVersion ! ===> 3.740000009536743 (which is the correct, expected value :) -- but I haven't got it to work in a file yet. "Anton/fmod-version.factor" run-file Error Assertion failed assert-got 3 assert-expect 2 Thanks for your help ! Anton. > Hi, > > I only recently discovered that on Windows, some stdcall libraries do > funny name mangling; symbols are not named as one would expect. So a > function 'Foo' is actually '[EMAIL PROTECTED]' in the DLL, where x is the > amount > of stack space, in bytes, its parameters take up. For Factor 0.89, I > will fix the FFI so that this is supported transparently, since it is > not hard to compute this number at all, but for now here's a workaround: > > First, note that > > LIBRARY: fmod > FUNCTION: float FSOUND_GetVersion ( ) ; > > Is equivalent to: > > : FSOUND_GetVersion > "float" "fmod" "FSOUND_GetVersion" { } alien-invoke ; > > So you can try > > : FSOUND_GetVersion > "float" "fmod" "[EMAIL PROTECTED]" { } alien-invoke ; > > However the @0 might be @4, I forget if the return value is taken > into account or not. You can use a tool to list the symbols in a DLL > to find out. > > In the future there will be a new ABI parameter, "manged-stdcall", > just like "stdcall" except with this mangling going on behind the > scenes. You will be able to use FUNCTION: again. > > Of course we still need unmangled stdcall support since system DLLs > like kernel32.dll are built this way. I have no idea why. > > Windows is full of strange corner cases, this is just one example. > > Have fun, > > Slava > > PS: > > > I've also tried > > > > "fmod" load-library > > drop > > load-library is called for you; it is only useful to call it as a > debugging tool (see if it fails or not...) ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk