home *** CD-ROM | disk | FTP | other *** search
/ Programming Win32 Under the API / ProgrammingWin32UnderTheApiPatVillani.iso / src / mingw-runtime-19991107 / mingw / profile / gcrt0.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-11-04  |  1.2 KB  |  53 lines

  1. /* gcrt0.c
  2.  
  3.    Copyright 1998 Cygnus Solutions.
  4.  
  5. This file is part of Cygwin.
  6.  
  7. This software is a copyrighted work licensed under the terms of the
  8. Cygwin license.  Please consult the file "CYGWIN_LICENSE" for
  9. details. */
  10.  
  11. /*
  12.  * This file is taken from Cygwin distribution. Please keep it in sync.
  13.  * The differences should be within __MINGW32__ guard.
  14.  */
  15.  
  16. #include <sys/types.h>
  17. #include <stdlib.h>
  18.  
  19. #ifdef __MINGW32__
  20. typedef unsigned char u_char;
  21. typedef unsigned short u_short;
  22. typedef unsigned int u_int;
  23. typedef unsigned long u_long;
  24. #endif
  25.  
  26. extern u_char etext asm ("etext");
  27. extern u_char eprol asm ("__eprol");
  28. extern void _mcleanup (void);
  29. extern void monstartup (u_long, u_long);
  30. void _monstartup (void) __attribute__((__constructor__));
  31.  
  32. /* startup initialization for -pg support */
  33.  
  34. void
  35. _monstartup (void)
  36. {
  37.   static int called;
  38.  
  39.   /* Guard against multiple calls that may happen if DLLs are linked
  40.      with profile option set as well. Addede side benefit is that it
  41.      makes profiling backward compatible (GCC used to emit a call to
  42.      _monstartup when compiling main with profiling enabled).  */
  43.   if (called++)
  44.     return;
  45.  
  46.   monstartup ((u_long) &eprol, (u_long) &etext);
  47.   atexit (&_mcleanup);
  48. }
  49.  
  50. asm (".text");
  51. asm ("__eprol:");
  52.  
  53.