"Const" changes symbol table.

"Const" changes symbol table.

Post by Nicholas Drone » Sat, 17 Mar 2001 02:47:47



I found that including "extern" in the declaration
of the symbol in the file where it is defined fixes
this.

http://www.flash.net/~dtribble/text/cdiffs.htm#C99-const-linkage

Regards,

Nicholas


> I'm am trying to use "const" in the declaration of a symbol -- call
> it "Srvtds_Nume_Prec_to_Len."  The symbol is defined in one file
> (srvrow.cpp) and declared in another file (srvparm.cpp) as
> "extern . . . ."  When I change the declarations to use
> "const . . . = . . . " and "extern const . . . ", the symbol
> table in srvrow.o is different.
> # Without "const"
> $ nm srvparm.o srvrow.o | grep Srvtds
> [26]    |         0|       0|NOTY |GLOB |0    |UNDEF |Srvtds_Nume_Prec_to_Len
> [10]    |         0|      78|OBJT |GLOB |0    |3     |Srvtds_Nume_Prec_to_Len
> # With "const"
> $ nm srvparm.o srvrow.o | grep Srvtds
> [26]    |         0|       0|NOTY |GLOB |0    |UNDEF |Srvtds_Nume_Prec_to_Len
> [10]    |         0|      78|OBJT |GLOB |0    |3     |$XAGddhdKvPs6yAf.Srvtds_Nume_Prec_to_Len
> $ uname -r && CC -V
> 5.8
> CC: WorkShop Compilers 4.2 16 Jun 1998 C++ 4.2 patch 104631-07
> Any suggestions for understanding this and working around it?
> Regards,
> Nicholas