www.digitalmars.com         C & C++   DMDScript  

c++ - DMC pragma startup or equivalent?

reply xharbour_deletethis telkom.net.id (Andi Jahja) writes:
Hello,

I need to compile a program in C (not C++) mode and I also need a
function to be executed as start-up before any other functions.

IOW, I need something like Borland C "#pragma startup xxx"

How could I do this with DMC?

Thanks

Andi
Feb 05 2011
parent Walter Bright <newshound2 digitalmars.com> writes:
Andi Jahja wrote:
 I need to compile a program in C (not C++) mode and I also need a
 function to be executed as start-up before any other functions.
 
 IOW, I need something like Borland C "#pragma startup xxx"
 
 How could I do this with DMC?

Probably the easiest way is to make a C++ file (DMC will compile C++ files) and put the code in a static constructor.
Feb 19 2011