[fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress()
Fred van Stappen
fiens at hotmail.com
Mon Jan 13 14:36:46 CET 2014
> To: fpc-pascal at lists.freepascal.org
> From: el.es.cr at gmail.com
> Date: Mon, 13 Jan 2014 12:52:51 +0000
> Subject: Re: [fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress()
>
> 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 ?
___________
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140113/32039bdf/attachment.html>
More information about the fpc-pascal
mailing list