How to convert 64-bit COFF to OMF?

I need to convert a 64-bit .lib file from COFF

to OMF

. Coff2Omf.exe

works fine with 32 bit libraries, but gives ...

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

      

... on a 64-bit library. Is there an updated tool or similar for this?

+3


source to share


2 answers


Per Embarcadero Documentation:

Differences between C ++ compilers and previous generation C ++ compilers

Object and library file format

  • BCC32 and related 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 porting 32-bit Windows applications, you must change the references to .lib and .obj files as .a and .o respectively.

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



Compiled Object
File ELF64 Format

# pragma link

Do not include the file extension (.ext) for the modulename file if you are using the default file types. The compilers assume the following default file extension (.ext) values ​​for modulename:

  • .obj

    extension for BCC32
  • .o

    extension for:
    Clang-based C ++
    BCCOSX compilers

So, if you omit .ext

, then the correct extension will automatically be used according to your current target platform.

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

+2


source


I wonder if there ever was an OMF specification for a 64-bit architecture. By the way, why do you need 64-bit OMF files? C ++ Builder 64-bit builds on LLVM compiler base which creates ELF object files (as far as I know)



I don't know if something like coff2elf is related to C ++ Builder XE7, but maybe you can use open source tools like Object File Converter, look here: http: //www.agner .org / optimize / # objconv

+1


source







All Articles