Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2015-04

OSX Dynamically-linked Libraries Need cdecl Exports

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ADTEC Pty Ltd

Hi List

It appears that if you want to dynamically link to a library (both calling program and library created in Lazarus) in OSX Yosemite, any exported functions need to use the cdecl declaration, and not StdCall. The StdCall declarations work fine in Windows.

Lazarus 1.2.6
FPC 2.6.4
Win 7 64bit
OSX 10.10.2

Anyone else had this problem?

Also, where do you put the library? I've been copying it to /usr/lib to get it to work. How do I store it in the MacOS or Resources directory of the .app and have it found at run-time?

Thanks

Graham.

Reply by email

Dmitry Boyarintsev
to ADTEC Pty Ltd
Anyone else had this problem?

It's not a problem it's rather a common convention.

Windows platform is using stdcall for dynamic libraries. Unix platforms (OSX included) is using cdecl.

An example OpenGL binding in FPC are working fine this way.

Also, where do you put the library? I've been copying it to /usr/lib

to get it to work. How do I store it in the MacOS or Resources directory of the .app and have it found at run-time?

Try to put the library into:
youprogram.app/Contents/Frameworks/

https://developer.apple.com/library/mac/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20150414/5764d8e8/attachment.html>

Reply by email