home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / config / rs6000 / eabi-ctors.c < prev    next >
C/C++ Source or Header  |  1995-07-21  |  2KB  |  59 lines

  1. /* Stripped down support to run global constructors and destructors on
  2.    embedded PowerPC systems.
  3.  
  4.    Copyright (C) 1995 Free Software Foundation, Inc.
  5.    Contributed by Michael Meissner  (meissner@cygnus.com).
  6.  
  7. This file is part of GNU CC.
  8.  
  9. GNU CC is free software; you can redistribute it and/or modify
  10. it under the terms of the GNU General Public License as published by
  11. the Free Software Foundation; either version 2, or (at your option)
  12. any later version.
  13.  
  14. GNU CC is distributed in the hope that it will be useful,
  15. but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. GNU General Public License for more details.
  18.  
  19. You should have received a copy of the GNU General Public License
  20. along with GNU CC; see the file COPYING.  If not, write to
  21. the Free Software Foundation, 59 Temple Place - Suite 330,
  22. Boston, MA 02111-1307, USA.  */
  23.  
  24.  
  25. /*  Declare a pointer to void function type.  */
  26.  
  27. typedef void (*func_ptr) (void);
  28.  
  29. /* Declare the set of symbols use as begin and end markers for the lists
  30.    of global object constructors and global object destructors.  */
  31.  
  32. extern func_ptr __CTOR_LIST__[];
  33. extern func_ptr __CTOR_END__ [];
  34. extern func_ptr __DTOR_LIST__[];
  35. extern func_ptr __DTOR_END__ [];
  36.  
  37. /* Call all global constructors */
  38. void
  39. __do_global_ctors (void)
  40. {
  41.   func_ptr *ptr = &__CTOR_LIST__[0];
  42.   func_ptr *end = &__CTOR_END__[0];
  43.  
  44.   for ( ; ptr != end; ptr++)
  45.     (*ptr)();
  46. }
  47.  
  48. /* Call all global destructors */
  49. void
  50. __do_global_dtors (void)
  51. {
  52.   func_ptr *ptr = &__DTOR_LIST__[0];
  53.   func_ptr *end = &__DTOR_END__[0];
  54.  
  55.   for ( ; ptr != end; ptr++)
  56.     (*ptr)();
  57. }
  58.  
  59.