NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: Paul Shaw on March 19, 2006, 06:57:26 AM

Title: NASM for Windows 'ld' comman
Post by: Paul Shaw on March 19, 2006, 06:57:26 AM
Hi!
I have installed the most recent NASM for Windows.
When using a Win XP Pro command prompt I seem to be able to assemble OK with nasm -f elf filename.asm. I get an object file .o or .obj. But when I try to link with the command ld -o filename filename.o I get that ld is not recognised as an internal or external command, operable program or batch file. What is going on?
One of the other students in my class has the same problem.
Title: Re: NASM for Windows 'ld' comman
Post by: nobody on March 19, 2006, 09:47:40 AM
Looks like you're trying to use Linux commands in Windows. "-f elf" will produce a linkable object file - whatever OS Nasm is running on - but the object format won't be right for Windows. Windows uses a varient of the COFF (common object file format) - "-f win32". (Nasm's "-f coff" is a different kind of COFF) There *is* a port of the linker "ld" to Windows, but it sounds like you haven't got it - or haven't got it installed right. Maybe available on the prof's computer, but not yours? You can get the Windows "ld" (and more) with the MinGW package, or the Cygwin package. Google for 'em if just ".org" doesn't work - probably will.

Better yet, install Linux, and "-f elf" and "ld" will work great!!!

Best,
Frank
Title: Re: NASM for Windows 'ld' comman
Post by: Paul Shaw on March 19, 2006, 12:48:29 PM
Thanks, Frank.
I think you comments are spot on and they have been very helpful.
Unfortunately, I am stuck with Win XP for web work.
I am going to have a play with Alink and see whether I can get that to work.
I did have Cygwin before and found it great. Maybe it's time to get it again.