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

Lukasz Sokol el.es.cr at gmail.com
Mon Jan 13 15:39:46 CET 2014


On 13/01/14 13:36, Fred van Stappen wrote:
[...] 
> Hello Lucaz
> 
> /// why not just :
>>
>> @soundtouch_createInstance := DynLibs.GetProcedureAddress(LibHandle, PAnsiChar('soundtouch_createInstance'));
>>
> 
> Get that error :
> 
>>> libSoundTouch.pas(56,5) Error: Can't assign values to an address
> 

This (@syntax) is in (OBJ)FPC mode, your example is Delphi mode.



http://wiki.freepascal.org/Lazarus/FPC_Libraries#Loadlibrary_-_dynamically_loading_a_dynamic_library

http://forum.lazarus.freepascal.org/index.php?topic=1148.0

OK I stand corrected, re. the pointer() cast... 

but then why not declare in a public header for this wrapper:
type
  TSoundtouchCreateInstanceProc = procedure;

then
soundtouch_createinstance := TSoundtouchCreateInstanceProc(DynLibs.GetProcedureAddress(...));

(nb. delphi mode)

?

-L.




More information about the fpc-pascal mailing list