Author Topic: Linker in windows  (Read 11915 times)

nobody

  • Guest
Linker in windows
« on: October 26, 2008, 04:45:16 PM »
Which Linker should I choose for Windows?
And how I can use it.

mcamember

  • Guest
Re: Linker in windows
« Reply #1 on: October 26, 2008, 09:50:25 PM »
There are at least two you can use :
polink.exe and golink.exe

This address
http://www.geocities.com/nasm32/

has a link for each program under the Sources heading.
Be aware that the Pelles is a 6 or 7 meg file from which you need
 to extract only the linker (polink.exe).

The following commands should work for you using
NASM and Pelles POLINK. The entries after LIBPATH will
need to be modified for your own directory structure.
Of course you might need to add the names of additional .lib files to the string.

nasm -f win32 winprog.asm  -o winprog.obj

polink.exe /SUBSYSTEM:WINDOWS /ENTRY:main /LIBPATH:\nasm32\bin\lib\win32    winprog.obj kernel32.lib user32.lib

If you use polink, the .asm file will need a statement similar to
    entry winprog
at the start of the .TEXT section.
;-------------------------------------------------
And for NASM and GOLINK :

nasm -f win32  winprog.asm -o winprog.obj

golink.exe  /entry:start winprog.obj kernel32.dll user32.dll

If you use golink, the .asm file will need a statement similar to
    start:
at the start of the .TEXT section.

Notice that golink accesses the .DLL files directly with no need
for a LIBPATH. It uses the PATH variable on your  machine to find the location.
On my machine it's C:\WINNT\SYSTEM32.

The above website has a number of small windows programs
under the Sample Code link and each one has it's own batch files.
All were written in NASM 0.98.39.

hth
;mcamember