Hi,
I'm having some trouble understanding the behavior of the -h option of the cl6x compiler:
--make_static,-h Make all global symbols static
I'm trying to compile and link the following code:
one.c
====
struct {
char infot, iounit;
char ok, lerr;
char po;
} infoc_;
int a;
void initvalue1(void){
a = 1;
}
void printvalue1(void){
printf( "%d", a );
}
two.c
====
struct {
int infot, unit;
int ok, lerr;
} infoc_;
int a;
void initvalue2(void){
a = 2;
}
void printvalue2(void){
printf( "%d", a );
}
three.c
====
int main(void){
initvalue1();
initvalue2();
printvalue1();
printvalue2();
return 0;
}
My understanding is that, using the following lines for compiling/linking, variables infoc and a should be made static, and thus this should work with the following lines:
cl6x -c one.c
cl6x -c two.c
cl6x -c three.c
cl6x -z -h one.obj two.obj three.obj -o allstatic.out
However, I am still getting linking errors:
<Linking>
error: symbol "_infoc_" redefined: first defined in "one.obj"; redefined in
"two.obj"
error: symbol "_a" redefined: first defined in "one.obj"; redefined in
"two.obj"
error: errors encountered during linking; "allstatic.out" not built
Am I misunderstaiding the behaviour of the -h option for the linker? Variables a and infoc sholud be considered static when linking, is that correct?
Thanks in advance.