[fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress()

Fred van Stappen fiens at hotmail.com
Sat Jan 18 12:24:13 CET 2014


Yep, yep, yep, i get it...

I will (try) to explain the thing...
The error comes mainly because i was focused on SoundTouchDLL.h. (Thanks to Ludo).

That wrapper is for windows only.

Before to call a DSP-buffer-procedure, you must do :
FHandle := soundtouch_createInstance(); 

But the result of nm libSoundTouch.so gives 3 different soundtouch_createInstance() :

_ZN10soundtouch14TransposerBase11newInstanceEv
_ZN10soundtouch9FIRFilter11newInstanceEv
_ZN10soundtouch9TDStretch11newInstanceEv

The same (for example) for setChannels :

_ZN10soundtouch14TransposerBase11setChannelsEi
_ZN10soundtouch9TDStretch11setChannelsEi
_ZN10soundtouch14RateTransposer11setChannelsEi

And after creating new instance, you must use the procedure of the kind of instance :
_ZN10soundtouch9TDStretch11newInstanceEv
with _ZN10soundtouch9TDStretch11setChannelsEi

And all the procedures defined by SoundTouchDLL.h are not working because the "general" function soundtouch_createInstance() is not part of the library ( or i do not find it ) , all the "general" soundtouch procedure cannot work :

ZN10soundtouch10SoundTouch11setChannelsEj (and all the "general" others)
______________

Now, conclusion of that hard battle :

1) With fpc, there is ALWAYS a solution.
2) Without the help of Ludo, Ewald and Marco i never would find that solution.
3) If you want create pascal wrappers I highly recommend to use "nm the_problematic_lib.so" and analyse carefully the result.
4) Dynlibs.pas is working perfectly and (for me) one of the most important part of fpc (because it opens fpc to other worlds).

Biggest thank for helping.
Have perfect days.

PS : I will post the definitive wrapper when everything is working.
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140118/91a42d43/attachment.html>


More information about the fpc-pascal mailing list