Thread View: gnu.g++.help
1 messages
1 total messages
Started by Ed Barton
Fri, 07 Aug 1992 08:36
order of initialization
Author: Ed Barton
Date: Fri, 07 Aug 1992 08:36
Date: Fri, 07 Aug 1992 08:36
31 lines
1627 bytes
1627 bytes
In current C++ systems, it is difficult or impossible to get control of the order of global initializations. In many implementations, the order can be influenced by changing the order of the object files, but it is difficult to apply this hack when some of the object files come out of a library and others come from the user's code. I have heard that this topic is being discussed by the C++ standards people, and that eventually there may be some solution. In the meantime, are there any #pragmas in g++ that will allow the programmer to influence the order of global constructors between different files? If there are not any, I plan to implement a fairly stupid scheme in my copy of g++. The scheme would work as follows: Modify the compiler to recognize #pragma initialization_order 10004 in a C++ source file, and cause it to influence the name of the file function so that the initialization order number is encoded in the name. Modify collect to recognized these encoded order numbers when they occur, and to sort the file functions by ascending order number, with initializations that have no number coming last. Although the scheme is trivial, its implementation may not be, because I am not a g++ expert. Please let me know if there is already something that will work. Thanks for any suggestions.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads