Displaying 3 results from an estimated 3 matches for "__initialize".
Did you mean:
x_initialize
2009 Mar 07
0
[LLVMdev] global question
...then be two definitions of x, a link-time error.
>
FWIW
-------- main.c ----------
#include <stdio.h>
int x;
int main(int arcg, char **argv) {
fprintf(stderr, "x is: %d\n", x);
return 0;
}
---------- init.c ---------
extern int x;
__attribute__((constructor))
static void __initialize() {
x = 12;
}
[MacBook:~/Desktop]% gcc -c init.c
[MacBook:~/Desktop]% gcc -c main.c
[MacBook:~/Desktop]% gcc -o test init.o main.o
[MacBook:~/Desktop]% ./test
x is: 12
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/a...
2009 Mar 07
3
[LLVMdev] global question
> Please correct me if I'm wrong, but how can the compiler know, that x is not
> initialized in another file which defines x as extern? It can only be
> sure, when x is declared static.
I don't think you can attach an initializer to an extern except at the
point where the variable is defined. But since x is defined here, there
would then be two definitions of x, a link-time
2000 Nov 06
2
Mac project files in mainstream
Hmm... The Mac makefiles are beginning to get really out of date in the
mainstream ogg and vorbis trees. As a mtter of fact, there aren't any
Mac makefiles in the ogg tree. I can make an attempt to update them,
but I'm not very good at library work (exported symbols confuse the hell
out of me), or if Chris is listening, I'm making a request for an
update... please?
Thanks,