[fpc-devel] Building a static library
Jonas Maebe
jonas.maebe at elis.ugent.be
Tue Aug 26 23:00:53 CEST 2014
On 26/08/14 22:47, Sergio Flores wrote:
> So I did create my own static library by gathering all .o files from FPC
> into a .a file. I wrote a .h header and added the static lib into a
> Xcode Objective-C project.
> Ok, it compiles and links correctly. It calls some of the pascal
> functions correctly. But.. then it later crashes in one of the pascal
> functions.
>
> Note that I have a lib_init() function called from C that is used to
> initialize the pascal library, and it calls this undocumented fpc function:
>
> procedure internal_initializeunits(); external name 'FPC_INITIALIZEUNITS';
>
> This function from what I understood it calls all units initialization
> sections, right?
On OS X, you must not call that or any other initialisation function
manually, because even static libraries can contain an initialisation
section on that platform. If you do exactly the same as the iOS Xcode
template, then your static library will contain all object files
generated for a dynamic library and one of these will already cause the
RTL intialisation code to be called.
Jonas
More information about the fpc-devel
mailing list