[fpc-devel] Mac OS X dylib exported symbols

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Dec 19 16:21:56 CET 2006


On 19 dec 2006, at 15:50, Vlad wrote:

> I made dylib with FPC (compiled in delphi mode if it is important).  
> I have functions that I want to export listed in "exports" section,  
> a few hundreds exported and that works fine but when I run otool it  
> shows me thousands - class methods, functions, almost everything,  
> and it seems like this symbols take a lot of space in the dylib,  
> almost half of it. And I cannot strip them. Can anybody explain  
> what it the reason why they are exported?

If you compile a dynamic library with FPC, it automatically  
statically links in a copy of all units you use in that library (also  
RTL units). You cannot strip these, since they are used by the  
library code (and smart linking, or dead code stripping as Apple  
calls it, is not yet supported on Mac OS X due to bugs in Apple's  
linker).

The reason they are also exported, is that they are global symbols  
(i.e., they appear in the interface of a unit). I know the manual  
states that no symbols will be exported unless you mention them in  
the export statement, but afaik this is wrong in general (except  
maybe on Windows?)


Jonas



More information about the fpc-devel mailing list