Hi all!
I'm trying to make a *.dylib with FPC/Lazarus for Mac and use it from Objective-C code. How can I do that correctly?
The way I do that now is compiling *.dylib with "exports" section, which lists all functions I want to export (all declared as "cdecl"). Next, I just drag&drop *.dylib file into "Frameworks" section of Xcode project and create *.h file with exact same declaration as in my lazarus sources. When I run app from Xcode my *.dylib just happens to be loaded and I can call exported functions from it.
But this way has one big problem - "initialization" sections of all units (including system ones such as Classes, SysUtils, CThreads and so on) don't get called. Why? Can anyone help me with that?