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

Sven Barth pascaldragon at googlemail.com
Tue Jan 14 15:01:21 CET 2014


Am 14.01.2014 13:21 schrieb "Fred van Stappen" <fiens at hotmail.com>:
>
> >Now, for the windows version, I don't know what underlying mechanism
> >dynlibs uses under windows, so I'm afraid I can't really comment on that
>platform, except that you could try a similar approach as on linux (use
symbol
> >names instead of indices). OTOH it could (?) be that the the compiler
inserts
> >code to typecast PChar(1) to a string, which could result in an access
violation
> > (try `var a: string; a:= pchar(1);` to try it out ;-) ).
> >Ewald
>
> Many thanks Ewald.
> I decided to use windows unit for Windows (it works so...).
> Sadly, for Linux, i do not find a solution...
> Many thanks.

For Linux you *must* use the name and not the ordinal and for Windows I'd
advice you the same except the author of that DLL documents that the
ordinals will stay the same between versions (but even then using the name
is more portable).

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140114/dcfd5476/attachment.html>


More information about the fpc-pascal mailing list