[fpc-pascal] windows.GetProcAddress() vs DynLibs.GetProcAddress()
Fred van Stappen
fiens at hotmail.com
Mon Jan 13 14:14:44 CET 2014
On Mon, 13 Jan 2014, Fred van Stappen wrote:
>
> On Mon, 13 Jan 2014, Fred van Stappen wrote:
>
>
> > > > begin
> > > > LibHandle:=DynLibs.LoadLibrary(libfilename);
> > > > if LibHandle <> DynLibs.NilHandle then
> > > >
> > > > Pointer(soundtouch_createInstance) := DynLibs.GetProcedureAddress(LibHandle, PAnsiChar('soundtouch_createInstan
> ce
> > '));
> > >
> > > Remove the typecast PansiChar()
> > >
> > > Michael.
> > > >> Hello Michael and thanks for answer.
> > > But if i remove PansiChar(), i still get :
> > > An unhandled exception occurred at $0000000000000000:
> > > EAccessViolation: Access violation
> > > $0000000000000000
> >
> > 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();
>
> Do a
>
> Writeln((@soundtouch_createInstance)=Nil);
>
> Michael.
> ___________
> Thanks Michael.
> Result in Linux for :
> if ST_Load('/home/fred/libSoundTouch/libSoundTouch.so')
> then writeln('ok') else writeln('no') ;
> >> ok
> Writeln((@soundtouch_createInstance)=Nil);
> >> FALSE
> I agree it is very strange, in windows, with unit Windows, it works perfectly..
Wait.
What happens if you use dynlibs on windows ?
Because there can be 1000 other reasons why the load failed on linux,
not necessarily connected to dynlibs.
Michael.
____________________________________________
Yep, Michael, many thanks for helping.
>> What happens if you use dynlibs on windows ?
Exactly the same as for Linux, it crash.
What i do not understand it is why, with Windows unit, it works perfectly and with Dynlibs unit, it crash. (with same code, of course).
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140113/db4eb0ef/attachment.html>
More information about the fpc-pascal
mailing list