T
Torsten Mueller
I have to create a shared library containing C++ classes with static
member variables on HPUX with aCC. I can compile and link the library
and a test application but when I start the program I get errors like
these:
/usr/lib/dld.sl: Unresolved symbol: namespaces (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: m_mapFielTypeIDsUBSHaben__Q2_10Validators9CBaseCopy (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: m_mapFielTypeIDsPFHaben__Q2_10Validators9CBaseCopy (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: typeid__XTQ2_10Validators9CBaseCopy_ (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: m_mapFielTypeIDsUBSSoll__Q2_10Validators9CBaseCopy (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: m_mapFielTypeIDsPFSoll__Q2_10Validators9CBaseCopy (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: typeid__XTQ2_10Validators21CUBSKtoSplitValidator_ (data) from /beda/lib/libLogicalValidation.sl
All these unresolved symbols are private static member variables. I
think their instances (sure they have instances) are not exported from
the shared library.
I compile my source files using the following command line:
aCC -g0 +Z -I ... -c -o ... $<
-g0 produces debugger information, +Z makes position independent code,
-I, -c and -o are as usual. I link the shared library using this:
aCC -g0 -b -n -L ... -l ... -o ... $(OBJ)
The aCC man page says:
-----------------------------------------------------------------
-b Cause the linker ld(1) to create a shared library
rather than a normal executable file. Object files
processed with this option must contain position
independent code (PIC). For details see ld(1), HP-UX
Linker and Libraries Online User's Guide and the
Programming on HP-UX manual.
-n Cause the output file from the linker to be marked as
shareable. For details and system defaults, see ld(1).
-----------------------------------------------------------------
Do I have to use any other specific compiler switch to export static
variables? Or do I have to use a specific construction in my code? Did
anybody have this problem?
T.M.
member variables on HPUX with aCC. I can compile and link the library
and a test application but when I start the program I get errors like
these:
/usr/lib/dld.sl: Unresolved symbol: namespaces (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: m_mapFielTypeIDsUBSHaben__Q2_10Validators9CBaseCopy (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: m_mapFielTypeIDsPFHaben__Q2_10Validators9CBaseCopy (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: typeid__XTQ2_10Validators9CBaseCopy_ (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: m_mapFielTypeIDsUBSSoll__Q2_10Validators9CBaseCopy (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: m_mapFielTypeIDsPFSoll__Q2_10Validators9CBaseCopy (data) from /beda/lib/libLogicalValidation.sl
/usr/lib/dld.sl: Unresolved symbol: typeid__XTQ2_10Validators21CUBSKtoSplitValidator_ (data) from /beda/lib/libLogicalValidation.sl
All these unresolved symbols are private static member variables. I
think their instances (sure they have instances) are not exported from
the shared library.
I compile my source files using the following command line:
aCC -g0 +Z -I ... -c -o ... $<
-g0 produces debugger information, +Z makes position independent code,
-I, -c and -o are as usual. I link the shared library using this:
aCC -g0 -b -n -L ... -l ... -o ... $(OBJ)
The aCC man page says:
-----------------------------------------------------------------
-b Cause the linker ld(1) to create a shared library
rather than a normal executable file. Object files
processed with this option must contain position
independent code (PIC). For details see ld(1), HP-UX
Linker and Libraries Online User's Guide and the
Programming on HP-UX manual.
-n Cause the output file from the linker to be marked as
shareable. For details and system defaults, see ld(1).
-----------------------------------------------------------------
Do I have to use any other specific compiler switch to export static
variables? Or do I have to use a specific construction in my code? Did
anybody have this problem?
T.M.