James,

Thanks. I think I understand the issue, but I'm still not sure how to fix it?

I'm not that familiar with C++, but I don't see any mismatched definitions in the code.

Are you recommending that all "const char* const ... " in the sources be changed to "const char* ... " ? I'm a bit reluctant to make such an extensive change to the API of this library.
Is there a linker flag that would tell it to tolerate these extra const's ?

John



James Lee wrote:
On 27/05/09, 19:25:50, John Ellson <[email protected]> wrote regarding
[csw-maintainers] need help with C++ linker error from Sun's linker:

If I compile liblasi (mgar/pkg/liblasi/trunk) using g++ it compiles and
links without problem.

If I use Sun's tools  (remove the line: "CXX=/opt/csw/gcc4/bin/g++ \"
from the Makefile)
then I get this error:

...

Undefined                       first referenced
 symbol                             in file
void LASi::PostscriptDocument::setFont(const

char*const,LASi::FontStyle,LASi::FontWeight,LASi::FontVariant,LASi::Font
St
retch)
CMakeFiles/example0.dir/MissingGlyphExample.o
ld: fatal: Symbol referencing errors. No output written to example0



There's something odd about the "const char*const"   but I don't know if
thats related.


I think you've almost answered your own question.   gcc does not use
"const" type qualifier for types passed by value when making external
names.  So "const char*const" is the same as "const char*" on the call
because the value is copied anyway (the second "const" is of benefit to
the compiler in the function only).  Nevertheless CC likes consistency
so try matching the "const"s in all function declarations.




$ cat sub.cc
void sub(const char*const arg)
{
    return;
}

$ g++ -c sub.cc
$ nm -C sub.o


sub.o:

[Index]   Value      Size    Type  Bind  Other Shndx   Name

[2]     |         0|       0|SECT |LOCL |0    |1      |
[3]     |         0|       0|SECT |LOCL |0    |2      |
[4]     |         0|       0|SECT |LOCL |0    |3      |
[5]     |         0|       0|SECT |LOCL |0    |4      |
[6]     |         0|      16|FUNC |GLOB |0    |1      |sub(const char*)
                                                       [_Z3subPKc]
[1]     |         0|       0|FILE |LOCL |0    |ABS    |sub.cc

$ CC -c sub.cc
$ nm -C sub.o


sub.o:

[Index]   Value      Size    Type  Bind  Other Shndx   Name

[1]     |         0|       0|FILE |LOCL |0    |ABS    |sub.cc
[2]     |        16|      24|FUNC |GLOB |0    |2      |void sub(const
char*const)

[__1cDsub6Fkpkc_v_]




James.
_______________________________________________
maintainers mailing list
[email protected]
https://lists.opencsw.org/mailman/listinfo/maintainers


_______________________________________________
maintainers mailing list
[email protected]
https://lists.opencsw.org/mailman/listinfo/maintainers

Reply via email to