is there a way to change the entry point like this.


start:
SomeData db 0, 0.......
EntryPoint:
invoke ExitProcess, 0
end start


I thought about mving the start directive but wouldn't that mean everything before it wasn't included since everything after the end directive is ignored?
Posted on 2004-01-22 22:43:43 by ENF
It is not the Start label that determines the entry point, it is the end directive, you set the entry point like this:

start:

SomeData db 0, 0.......
EntryPoint:
invoke ExitProcess, 0
end EntryPoint


Everything in the .CODE section is compiled up to the END directive so it will still be there and executable.
Posted on 2004-01-22 22:57:44 by donkey
many thanx donkey.
Posted on 2004-01-22 23:17:02 by ENF
yet detailed knowledge base and you put alot of effort into answering people's questions. Your alright dude :alright:
Posted on 2004-01-23 11:58:42 by mrgone
Thanks mrgone,

My pleasure big guy !
Posted on 2004-01-23 12:20:28 by donkey
mrgone,

Also, you can set the entry point by specifying an external label with the linker's /ENTRY option:


link /ENTRY:myentrypoint /SUBSYSTEM:... etc...
Posted on 2004-01-23 12:36:31 by Vortex
But I think that the linker need know where is the symbol??, this mean put some like: global or public for the symbol, and in this way, the linker will can find the symbol in the input files..... is that correct?
Posted on 2004-01-25 00:29:01 by rea
The linker does not need to find the symbol - the ADDRESS of the entrypoint is placed in the object file (relative to the object file's starting address, of course). That is, If I Remember Correctly.
Posted on 2004-01-25 07:46:18 by AmkG
If you specify the entrypoint on the commandline, the symbol has to be available. Also, for COFF objects, there's no "this is the entrypoint" kinda thing like (I think) OMF had... so the way it's done, is that masm puts a "/ENTRY:entrypoint" line in the .drectve section - where linker options are put.

EDIT: I think this means that your entrypoint symbol will be made public, whether you have declared it such or not.
Posted on 2004-01-25 07:54:20 by f0dder

is there a way to change the entry point like this.


start:
SomeData db 0, 0.......
EntryPoint:
invoke ExitProcess, 0
end start


I thought about mving the start directive but wouldn't that mean everything before it wasn't included since everything after the end directive is ignored?



SomeData db 0, 0.......
start:
invoke ExitProcess, 0
end start
Posted on 2004-01-25 10:08:23 by The Svin
If you don't specify the entry point in an END, then the /ENTRY:entry must specify a PUBLIC (or EXTERNDEF) label.

So:

    .model flat ; no protocol default (no name decoration)

.code

public _start

_start: ; this will be the entry point

end ; no start address
with the following:

link ... /ENTRY:start ...

Notice that the linker will automatically prepend an underscore (_) before searching for the symbol in the object file.
Posted on 2004-01-27 13:40:14 by tenkey