[fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress()
Lukasz Sokol
el.es.cr at gmail.com
Mon Jan 13 13:52:51 CET 2014
Hi,
'scue me if I did not catch something, but
On 13/01/14 12:13, Fred van Stappen wrote:
[...]
>> > procedure InitLib(LibFile : PAnsiChar);
>> > begin
>> > LibHandle:=DynLibs.LoadLibrary(libfilename);
>> > if LibHandle <> DynLibs.NilHandle then
>> >
>> > Pointer(soundtouch_createInstance) := DynLibs.GetProcedureAddress(LibHandle, PAnsiChar('soundtouch_createInstance'));
>>
/// why not just :
@soundtouch_createInstance := DynLibs.GetProcedureAddress(LibHandle, PAnsiChar('soundtouch_createInstance'));
(or without the PAnsiChar cast as Michael said:)
@soundtouch_createInstance := DynLibs.GetProcedureAddress(LibHandle, 'soundtouch_createInstance');
?
>> Remove the typecast PansiChar()
>>
>> Michael.
[...]
>
> What is the value of Pointer(soundtouch_createInstance) after the above statement ? Is it nil ?
>
> Michael.
>
> Thanks for answer Michael.
>
> Hum, how can i get the value of pointer if the application crash when i do :
>
>>> FHandle := soundtouch_createInstance();
>
> Maybe, i dont understood your question...
>
if Assigned(soundtouch_createInstance) then ShowMessage('Got good pointer for soundtouch_createInstance')
else ShowMessage('soundtouch_createInstance not assigned);
placed directly after the GetProcedureAddress call ?
More information about the fpc-pascal
mailing list