Author Topic: NASM for Windows 'ld' comman  (Read 20965 times)

Paul Shaw

  • Guest
NASM for Windows 'ld' comman
« 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.

nobody

  • Guest
Re: NASM for Windows 'ld' comman
« Reply #1 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

Paul Shaw

  • Guest
Re: NASM for Windows 'ld' comman
« Reply #2 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.