MSVC linker cannot find entry point in object files produced by NASM

91 views Asked by At

I'm experimenting with some assembly programming. Here is my very simple program :

extern ExitProcess

segment Main

Entry:

push 0
call ExitProcess

For assembling I use NASM :

nasm.exe -f win64 -o Entry.obj Entry.asm

The code compiles successfully. I then link the single object file with the MSVC linker :

link.exe /subsystem:console /entry:Entry /out:Test.exe Entry.obj kernel32.lib

The code does not link and gives me this error :

LINK : error LNK2001: unresolved external symbol Entry

I can't really figure out why there's an error, because I'm pretty that I have defined the entry point. I then try GoLink instead :

GoLink.exe /console /entry Entry /fo Test.exe Entry.obj

The code links successfully! But why? Why does my object file work with GoLink, but not with the MSVC linker? Do I have to specify some kind of linkage to make Entry visible to link.exe ?

0

There are 0 answers