Recent

Author Topic: How do you link gcc library and fpc/lazarus  (Read 1720 times)

xyzeugene

  • Newbie
  • Posts: 6
How do you link gcc library and fpc/lazarus
« on: March 01, 2018, 05:39:33 pm »
Hello,

Can someone give an example that links fpc/lazarus to a c library such as mylib.o.  I tried examples but all were outdated - the H2Pas example did not work either.

Thanks a bunch

Eugene  >:(

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12942
  • FPC developer.
Re: How do you link gcc library and fpc/lazarus
« Reply #1 on: March 01, 2018, 05:48:00 pm »
This depends on platform of course, since legacy C systems on every platform have different characteristics.

_IF_ the object type is compatible, you can link it by placing  {$link mylib.o} in your source.

You must then also satisfy all linking requirements of mylib.o (should be in the documentation provided with the .o or its compiler).

If it is Linux or *BSD, using unit "initc", might be a convenient workaround to link the basic legacy C libraries.  Mac OS X even links to it by default.


 

TinyPortal © 2005-2018