Hey guys! The other day I downloaded a snippet of NASM source code. After sniffing out the NASM compiler I was finally able to compile it into an .obj file. However, upon linking the .obj to my C++ code, I received this error:

'F:\AES TESTING\RIJNDAEL.OBJ' contains invalid OMF record, type 0x4c (possibly COFF)

I've looked around a bit and found a topic in the NASM forum and found out the issue is the incompatibilities between the way the linker/compiler works for NASM and my IDE (Borland C++ Builder 5).

The question I have to ask is if anyone knows of an IDE that has a linker that accepts .obj's from the NASM language/syntax. If I cannot find one that works, I'll have to convert the source syntax from NASM to TASM (which isn't too much of an issue, it's just time consuming for me :D)
Posted on 2009-07-23 11:40:36 by Kamikaze
If you want to keep on using borland's toolchain, you need to make NASM output OMF object files (check the manual). I'd suggest you move to a better environment (Visual C++ is nifty, and the express editions are free + has the features most people will need), most windows development tools support COFF format.
Posted on 2009-07-23 18:02:26 by f0dder
Thanks! That helps point me out in the right direction!

I tried using Dev C++ for the time being but it fell short where BCB5 did.
I'll be sure to read on the OMF section
Posted on 2009-07-23 18:14:55 by Kamikaze
Dev-C++ supports supports COFF, but there's two dialects of COFF; what GCC uses and what the rest use. Only difference I know of has to do with the way relocatable items are stored; this leads to perfect links, but corrupt code :)
Posted on 2009-07-23 18:24:30 by f0dder
Currently supported formats in the latest stable version of NASM are:

flat-form binary files (e.g. DOS .COM, .SYS)
Intel hex
Motorola S-records
Linux a.out object files
NetBSD/FreeBSD a.out object files
COFF (i386) object files (e.g. DJGPP for DOS)
ELF32 (i386) object files (e.g. Linux)
ELF (short name for ELF32)
ELF64 (x86_64) object files (e.g. Linux)
Linux as86 (bin86 version 0.3) object files
MS-DOS 16-bit/32-bit OMF object files
Microsoft Win32 (i386) object files
Microsoft Win64 (x86-64) object files
Relocatable Dynamic Object File Format v2.0
IEEE-695 (LADsoft variant) object file format
NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (i386) object files
NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (x86_64) object files

I've never actually tried using NASM with Borland development tools, but NASM does support OMF/OBJ format using the command line `nasm -f obj source.asm'. Try it out and see if it works is all I can tell you. IMHO, you'd probably be better off either obtaining an MS/COFF compliant C++ compiler or switching to TASM.
Posted on 2009-07-24 02:01:54 by Synfire
Check out Agner Fog's Object file converter
http://www.agner.org/optimize/#objconv
Posted on 2009-07-24 05:51:45 by drizz

Check out Agner Fog's Object file converter
http://www.agner.org/optimize/#objconv

Hey thanks! I'm going to give it a try and see if it'll work


Currently supported formats in the latest stable version of NASM are:

flat-form binary files (e.g. DOS .COM, .SYS)
Intel hex
Motorola S-records
Linux a.out object files
NetBSD/FreeBSD a.out object files
COFF (i386) object files (e.g. DJGPP for DOS)
ELF32 (i386) object files (e.g. Linux)
ELF (short name for ELF32)
ELF64 (x86_64) object files (e.g. Linux)
Linux as86 (bin86 version 0.3) object files
MS-DOS 16-bit/32-bit OMF object files
Microsoft Win32 (i386) object files
Microsoft Win64 (x86-64) object files
Relocatable Dynamic Object File Format v2.0
IEEE-695 (LADsoft variant) object file format
NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (i386) object files
NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (x86_64) object files

I've never actually tried using NASM with Borland development tools, but NASM does support OMF/OBJ format using the command line `nasm -f obj source.asm'. Try it out and see if it works is all I can tell you. IMHO, you'd probably be better off either obtaining an MS/COFF compliant C++ compiler or switching to TASM.

I'll probably switch over to TASM. I recompiled the files and linked them using the Visual Studio 2008 Express Compiler and it worked just fine. Once I get files down in TASM I shouldn't have any problems :D
And I think it's time to give Borland a rest. The pains of developing GUI apps and occasional failures has got to go...

Thanks for your help guys! I'm drowning in possibilities/options now  ;)
Posted on 2009-07-27 18:01:52 by Kamikaze