[fpc-pascal] Linking to library on Mac

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Jun 24 11:19:21 CEST 2011

On 24 Jun 2011, at 00:06, Darius Blaszyk wrote:

> I'm porting an app from delphi to lazarus and now I reached a  
> problem when trying to link to the library. The library comes with  
> the .dynlib .a and all header files. I placed them somewhere under  
> my homedir and added the following to my code:
> {$linklib mylibrary}
> I also pass the following switches to FPC (other tab on the project  
> options in Lazarus):
> -k-L/Users/dariusblaszyk/mylibraryfolder/

Use -Fl instead of hardcoded linker parameters (it won't solve your  
problem though)

> However I keep on getting undefined symbols.

If the errors are at compile time, then you will have to show how you  
are importing the routines in the Pascal code.

If the errors are at run time, then you may want to read the following  
documents for information about that:
* http://qin.laya.com/tech_coding_help/dylib_linking.html
* http://doc.qt.nokia.com/qq/qq09-mac-deployment.html

> How do I "install" the library properly on Mac and how do I make FPC/ 
> Lazarus correctly aware of this lib. The lib comes with a version  
> number, do I need to make symlinks to keep everything orderly?

Please be concrete when asking for help (this also applies to the rest  
of your mail): say what the actual file names are, what the exact  
directives are that you use in the source code, and what the exact  
compiler command line is you use to compile everything. Talking in  
generalities (especially about a platform you are not familiar with)  
and expecting people to figure out from that what the problem is does  
not work.


More information about the fpc-pascal mailing list