
|
[openbeos]
||
[Date Prev]
[02-2004 Date Index]
[Date Next]
||
[Thread Prev]
[02-2004 Thread Index]
[Thread Next]
[openbeos] initialize_before, _init, etc.
- From: "Andrew Bachmann" <shatty@xxxxxxxxxxxxx>
- To: "openbeos" <openbeos@xxxxxxxxxxxxx>
- Date: Mon, 02 Feb 2004 22:15:20 -0800 PST
Hello all,
There's been some discussion on the net list about a problem stemming from a
situation where
initialize_before wasn't called when a library was loaded. I figured it was
worth starting a
thread in the main list about it since it seems to be something that we should
(all) discuss. In
particular it seems that we can't generally rely on initialize_before. It's
not particular portable.
(read: at all) I thought maybe we could use these macros from kernel/image.h:
#define B_INIT_BEFORE_FUNCTION_NAME "initialize_before"
#define B_INIT_AFTER_FUNCTION_NAME "initialize_after"
#define B_TERM_BEFORE_FUNCTION_NAME "terminate_before"
#define B_TERM_AFTER_FUNCTION_NAME "terminate_after"
But you can't very well write anything like this:
void B_INIT_BEFORE_FUNCTION_NAME (void)
{
....
}
Because the name is quoted. I tried looking a bit on the net about this, and
in particular I looked
for _init and _fini. I found an interesting message:
http://mail.gnu.org/archive/html/libtool/2001-03/msg00017.html
... which recommended the use of __attribute__((constructor)) and
__attribute__((destructor)) I
did not test these on our gcc.
I think we should come up with one strategy for doing this and hopefully it
will be one that we
can reasonably port to other architectures, eh? Recommendations? Maybe even
just a set of
macros that we can use to capture the magic names? (in a format we can use to
define the
functions)
Andrew
|

|