by lunarg on June 11th 2012, at 17:32

When using external libraries (with .lib files) and are getting linker errors like below, you are using an imcompatible import library (.lib) file.

Invalid OMF record type 0x21 (possibly COFF)

The reason for this is that your import library file was designed for MSVC. The one uses the COFF format, which is not compatible with Borland's OMF format.

To solve this, try the following and in preferred order:

  1. Try obtaining the Borland compatible version of the import library. While difficult, this will always work.
  2. Use the conversion tools in Borland. Read Convert MSVC import libraries for use in Borland C Builder for more info on these tools.
  3. Try using IMPLIB to manually read out and import the library functions. Note that this one suffers from the same limitations as the one discussed in the article referenced in the previous solution.
  4. Forgo all linking inside your project and use the dynamic calls LoadLibrary and GetProcAddressA to manually get the pointers to the functions.