Hi Sean, 2013/11/25 Sean P. DeNigris <sean@clipperadams.com>
Sean P. DeNigris wrote
I'm wrapping the FMOD cross-platform audio library [snip] I have a few more questions
======== Problem #1: ========
I have the following callout: <primitive: #primitiveNativeCall module: #NativeBoostPlugin>
"FMOD_RESULT FMOD_System_Init( FMOD_SYSTEM *system, int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata);"
^ self nbCall: #(FMOD_RESULT System_Init(NBExternalAddress system, 32, 0, nil)).
It works fine on Mac. On Windows, it returns some crazy error code that is not listed in the API.
However, if I wrap the FMOD DLL in another DLL that just forwards all calls: FMOD_RESULT System_Init(FMOD_SYSTEM *system, int maxchannels, FMOD_INITFLAGS flags, void *extradriverdata) { return FMOD_System_Init(system, maxchannels, flags, extradriverdata); } When I call out to the wrapper DLL, it works! Does that provide a clue as to what's going wrong when calling from NB?
Other info: - Other dll functions succeed, so there is communication with the library. In fact, if I proceed past that first error, a sound starts to play... but then the VM crashes...
could it be a calling convention problem? cdecl, ...
======== Problem #2: ======== (much less important)
I wanted to be able to bundle the DLL with the image so one doesn't have to copy it into the VM folder. If I use the full path for the wrapper DLL described above, it is found, but when it calls fmodL.dll, which is in the same directory, it can't be found. I could only get it to work if at least fmodL.dll is in the VM plugins folder. Is there a way to specify more search locations for dynamic libraries from the image side?
I do not know if one can add more search locations. But, you can rebuild the full path from image side: Smalltalk imageDirectory / 'lib.dll' Cheers, Luc
Thanks!
----- Cheers, Sean -- View this message in context: http://forum.world.st/NativeBoost-Questions-while-wrapping-FMOD-tp4724116p47... Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.