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

Marco van de Voort marcov at stack.nl
Fri Jan 17 16:00:35 CET 2014


In our previous episode, Fred van Stappen said:
> I have only a problem with one procedure:
> 
> This c procedure is declared as this :
> SOUNDTOUCHDLL_API void __cdecl soundtouch_setSampleRate(HANDLE h, unsigned int srate);
> 
> And i translate it like that :
> 
> soundtouch_setSampleRate : procedure(h : THandle; srate :  cardinal); cdecl;
> and for dynamic-loading :
> Pointer(soundtouch_setSampleRate):= GetProcAddress(LibHandle, Pchar('_ZN10soundtouch10SoundTouch13setSampleRateEj'));
> 
> Sadly i get that message when i try to load that procedure :  

Handle is not defined on Linux. Many libraries emulate some handle type, but
it depends on the vendor if they make handle 32-bit or 64-bit.

Make sure that sizeof(HANDLE) in C++  matches sizeof(THandle) in FPC. Adjust
the type you use at the FPC side if necessary.



More information about the fpc-pascal mailing list