[Lazarus] RE : RE : RE : RE : Imposible call DLL (dylib) in Mac OSX Lion

Juan Sánchez aldeacity at gmail.com
Sun Aug 7 21:49:46 CEST 2011


Thanks a lot Ludo. Until tomorrow at evening I will not be able to test it
in Mac. So tomorrow as soon I can copy mesages I'll type them here.
Regards.
Juan.
El 07/08/2011 20:11, "Ludo Brands" <ludo.brands at free.fr> escribió:
>
>
>
> It went all right with dynamic loading. "liknlib" gives me and error in
> linking time. So I think runtime loading of dll is better. What I don't
know
> is what it's necessary rename functions with "_" at starting in Mac. Is it
a
> bug?
> Regards.
> Juan.
>
> It is not a bug. dlsym, the function used to find the address assumes C
type
> of function names which are prefixed with _. Pascal doesn't prefix
exported
> functions with _. See
>
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPa
> ges/man3/dlsym.3.html, down the page, notes.
>
>
> To make porting easier you can use the alias modifier with $ifdef like
this:
>
> function DllMessage(): Longint; {$ifdef darwin} alias : '_DllMessage';
> {$endif}
> ...
> exports DllMessage;
>
> This way, the function will be exported as _DllMessage on Darwin only,
> DllMessage on other platforms.
>
> Ludo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110807/d266e6ab/attachment-0003.html>


More information about the Lazarus mailing list