Recent

Author Topic: Linking against .lib or .obj produced by MS Visual Studio  (Read 4627 times)

abou.almontacir

  • New member
  • *
  • Posts: 7
Linking against .lib or .obj produced by MS Visual Studio
« on: October 31, 2014, 09:20:56 am »
Dear All,

I need to link a code produced with FPC against a code delivered by third party. This code can come either as .obj of .lib (can have choice). I know already about {$Link} and {$LinkLib} but seems like the linker does not understand the objects format.

Can anyone help please?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Linking against .lib or .obj produced by MS Visual Studio
« Reply #1 on: October 31, 2014, 09:44:17 am »
Afaik Visual Studio uses OMF format and FPC (and mingw) use COFF.

So you will need a omf<-> coff converter.  I know older versions C++Builder used to come with one the other way around (coff->omf). Maybe the tool can also do omf->coff.

I don't know how far this works, since the .objs probably also have visual studio runtime (msvcrt) dependencies. (IIRC .lib linkability is VS version dependent?)

Basile B.

  • Guest
Re: Linking against .lib or .obj produced by MS Visual Studio
« Reply #2 on: October 31, 2014, 09:53:21 am »
You also have ObjConv as a tool for converting objects format. In case of...but hard to use, the problem with objects is that depending on the format they can rely on other objects. But if the 3rd party stuff is officially distributed as a static lib or as obj then the 3rd party producer probably knows and has avoided the problem.

abou.almontacir

  • New member
  • *
  • Posts: 7
Re: Linking against .lib or .obj produced by MS Visual Studio
« Reply #3 on: October 31, 2014, 10:08:29 pm »
Thank you for your answers.
However I'm using MSVS 2010, so I assume the .obj and .lib files are in PE/COFF rather than in OMF. Moreover, the linker seems to be able to find functions but complains about invalid relocation fields in the header.

 

TinyPortal © 2005-2018