Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Convert 64bit COFF to OMF?

I need to convert a 64bit .lib file from COFF to OMF. Coff2Omf.exe works fine with 32bit libs but gives...

ERROR: COFF error: FOOx64.lib
(coffread.cpp, 1637) : invalid machine type detected

...on a 64bit lib. Is there an updated tool or similar to use for this?

like image 513
Max Kielland Avatar asked Dec 05 '25 10:12

Max Kielland


1 Answers

Per Embarcadero's documentation:

Differences Between Clang-based C++ Compilers and Previous-Generation C++ Compilers

Object and Library File Format

  • BCC32 and its associated tools use OMF in .obj and .lib files.
  • Clang-based C++ compilers use ELF in .o and .a files.

This difference means, for example, that when you migrate a 32-bit Windows applications you must change references to .lib and .obj files to be .a and .o, respectively.

BCC64.EXE, the C++ 64-bit Windows Compiler

Compiled object file
ELF64 format

#pragma link

Do not specify the file extension (.ext) of modulename, as long as you are using default file types. The linkers assume the following default values for the file extension (.ext) of modulename:

  • .obj extension for BCC32
  • .o extension for:
    Clang-based C++ compilers
    BCCOSX

So if you omit the .ext, then the correct extension is automatically used according to your current target platform.

OMF is only used by the 32bit compiler/linker. The 64bit compiler/linker uses ELF64 instead.

like image 76
Remy Lebeau Avatar answered Dec 07 '25 16:12

Remy Lebeau



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!