__attribute__ ((constructor)) question
Stephen Smith
ischis2@home.com
Tue Apr 3 16:55:00 GMT 2001
The following code is a code fragment from a program of mine. test_constructor() isn't
being run. I thought that test_constructor() was supposed to run before main. It used to work in
2.8.1 on my system.
target=powerpc-motorola-elf.
Any clue?
int testvalue = 0;
// Why doesn't this constructor work?
void test_constructor(void) __attribute__ ((constructor));
void test_constructor(void)
{
testvalue = 1;
}
main()
{
// some piece of code using testvalue and expecting it to be one.
}
More information about the Gcc
mailing list