function - MinGW Main routine -


in c there no main program. sure, c programmers begin int main(int argc char *argv[]), works because there routine tells compiler/ide run function named main first.

i can't seem find routine in mingw, though. defined? searched because wanted change (only test) , play around bit. can link me correct file in mingw folders?

the ld linker match of 1 of several symbols use entry point when linking pe file:

entry point              subsystem ---------------------   --------------  ntprocessstartup           native winmaincrtstartup          windows gui maincrtstartup             windows cui (console) __posixprocessstartup      posix cui winmaincrtstartup          wince gui maincrtstartup             xbox maincrtstartup             other  dllmaincrtstartup@12 (or possibly dllmaincrtstartup) dlls 

mingw have object file gets automatically linked in has actual pe entry point. - can see object files being automatically linked in using gcc's -v option.

in quick test using mingw 4.6.1 building console subsystem "hello world" program, object file containing entry point crt2.o , has symbol maincrtstartup picked linker entry point.

the source file containing entrypoint code crtexe.c (or crtdll.c).

you can override entry point using --entry option linker (wl,--entry=whatever when used on gcc command line).


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -