delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/06/22/04:59:55

To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Start-up calls; was: MORE on O_TEXT/O_BINARY
Date: Wed, 22 Jun 94 11:51:31 +0300
From: eliz AT is DOT elta DOT co DOT il

Mike Castle <mcastle AT cs DOT umr DOT edu> writes:
> When I ported PBMPlus to DOS, I modified the startup code
> (crt0.s) to switch stdin/stdout to binary, and change default
> mode to binary.  (Essentially, I added a function called FIXIO()
> to libc.a, and added a call to this function just before the call
> to main in the run time code).

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
for programs (such as fileutils) which will benefit from Unix-like wildcard
expansion (ala ``ls [a-z]*.exe''), in which case the expansion of argv[]
must be done before main() starts examining it.  The solution would be to
add a call to a function named, say, user_init() with the default (empty) body
in the library, so whoever needs this facility could write a function with
this name and include it at link time.  This would provide for easy and clean
solution to many porting problems.

Opinions, anyone?

	Eli Zaretskii

- Raw text -


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