News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

Entry point usage

Started by Stefan Pendl, October 16, 2011, 03:47:31 PM

Previous topic - Next topic

Stefan Pendl

Reading the information of the MSDN articles /ENTRY (Entry-Point Symbol) and UMENTRYABS results in the following table of entry points.


Environment| Default Entry Point| Absolute Entry Point
EXE native| | NtProcessStartup
EXE console| main| mainCRTStartup
EXE GUI| WinMain| WinMainCRTStartup
DLL| DllMain| _DllMainCRTStartup

Why would one use the absolute entry points, except for a native application where only the absolute one exists.

What is the advantage of using the absolute entry point, since Timo seems to use them quite frequently, or is this just a personal preference?

Thanks in advance.
---
Stefan

Proud member of the UltraDefrag Development Team

TimoVJL

Maybe bad habit  ;)
Just leaving out unnessary code (RTL/CRT) from executable when not needed, mostly when testing something.
Sometimes if i disassemble code with podump /DISASM to make shorter list to output window.
May the source be with you

Stefan Pendl

For testing to reduce the size of the executable it makes sense.

Thanks for your insight ;)
---
Stefan

Proud member of the UltraDefrag Development Team

CommonTater

#3
Quote from: Stefan Pendl on October 16, 2011, 03:47:31 PM
Reading the information of the MSDN articles /ENTRY (Entry-Point Symbol) and UMENTRYABS results in the following table of entry points.


Environment| Default Entry Point| Absolute Entry Point
EXE native| | NtProcessStartup
EXE console| main| mainCRTStartup
EXE GUI| WinMain| WinMainCRTStartup
DLL| DllMain| _DllMainCRTStartup

Why would one use the absolute entry points, except for a native application where only the absolute one exists.

What is the advantage of using the absolute entry point, since Timo seems to use them quite frequently, or is this just a personal preference?

Thanks in advance.

The application is always entered at the absolute entry point, Stefan.  Most programming languages do some startup stuff (memory manager, command line parsing, etc,) before calling their user entry point functions.   This startup code ends up in the executable.

For example:
Pelles C help file... Contents -> Appendix -> Program startup (two entries)... interesting stuff.