delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/06/22/11:01:20

Date: Wed, 22 Jun 94 10:37:39 -0400
From: dj AT ctron DOT com (DJ Delorie)
To: eliz AT is DOT elta DOT co DOT il
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Start-up calls; was: MORE on O_TEXT/O_BINARY

> 
> It seems to me there should be a way to call user-defined function BEFORE
> main() gets called.  The above is one example of the need.  Another one is
> 
> Opinions, anyone?

Use C++.  That's what conio does.  Consider these C++ examples:

-----------------------------------------------------------

static void
_dj_user_init_function()
{
  // do startup stuff
}

class _dj_user_init_class {
  _dj_user_init_class() { _dj_user_init_function() };
};
static _dj_user_init_class _dj_user_init_object;

-----------------------------------------------------------

static int
_dj_user_init_function()
{
  // do startup stuff
  return 0;
}

static int i = _dj_user_init_function();

-----------------------------------------------------------

While this won't give you access to main's arguments, it is completely
independent of djgpp's internals.


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019