HPUX, shared library and static member variables

From: Torsten Mueller (Homunkulus_at_gmx.net)
Date: 01/31/05

  • Next message: Steve: "file length..."
    Date: Mon, 31 Jan 2005 08:22:23 +0100
    
    

    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.


  • Next message: Steve: "file length..."

    Relevant Pages

    • Re: HPUX, shared library and static member variables
      ... > member variables on HPUX with aCC. ... I can compile and link the library ... > All these unresolved symbols are private static member variables. ...
      (comp.lang.cpp)
    • Re: Assigning "this"
      ... I also have a function in the class that I would like to change ALL Of the member variables. ... That said, let's go with your example nevertheless, with the assumption that we will ignore .NET's Point struct and assume we have a whole new Point type that is in fact a class... ... Hopefully you can see why, in a class, it doesn't make sense to try to replace the instance reference from within the instance itself. ... Again, I've seen some C# code changing the value of this, but are they in violation of a compile rule? ...
      (microsoft.public.dotnet.languages.csharp)
    • C++ problem with aCC compiler
      ... I am having a problem with aCC, ... The following code won't compile. ... matched were "unsigned char &operator (unsigned char ...
      (comp.sys.hp.hpux)
    • Re: OS requirements and gcc compatibility
      ... specific to GNU's libstdc++ on which you depend there might be issues. ... So if I compile my code with g++ v4.x then it won't work ... The question is why would aCC be different regarding compatibility? ...
      (comp.sys.hp.hpux)
    • Re: What will be the constructor flow of control
      ... Joel Martinez wrote: ... the code you supplied does not compile so I'm having a hard ... > time understanding what exactly you're trying to figure out. ... before or after the member variables are initialized; ...
      (microsoft.public.dotnet.languages.csharp)