xlC issue - Aix

This is a discussion on xlC issue - Aix ; Hello all, I'm having an issue with what I presume is xlC. I have a library of code that I use "ar" to archive. Inside that code, I have a singleton class to store application configuration options called dex::AppConfig. All ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: xlC issue

  1. xlC issue

    Hello all,
    I'm having an issue with what I presume is xlC. I have a library of
    code that I use "ar" to archive. Inside that code, I have a singleton
    class to store application configuration options called dex::AppConfig.
    All the code in this archive is using the namespace "dex".
    I went to create a new application that linked in this archived
    library, and it was going to use dex::AppConfig. This code is using the
    namespace "fileman". So, in main(), I set some options, and everything
    is fine.
    Next, main() goes and calls a singleton fileman::Config to read in it's
    configuration options. Config tries to store the data in the
    dex::AppConfig singleton, but when I do that, a new instance of
    dex::AppConfig is created.
    Now, I thought I was doing something wrong, so I took the code home and
    compiled it on a Linux machine with g++ and it works without a problem.
    I also took the code out of the library and set it up the same way (two
    different namespaces, etc) and it works.
    Is there an issue with xlC and singleton's in an archived library?

  2. Re: xlC issue

    Brian C writes:

    > I'm having an issue with what I presume is xlC.


    You can presume anything, but until you explain *in detail* what
    goes wrong, no one can help you.

    > Next, main() goes and calls a singleton fileman::Config to
    > read in it's configuration options. Config tries to store the
    > data in the dex::AppConfig singleton, but when I do that, a
    > new instance of dex::AppConfig is created.


    New instance? Where is the "old instance" created? How do you know
    there is more than one instance?

    > Now, I thought I was doing something wrong, so I took the code
    > home and compiled it on a Linux machine with g++ and it works
    > without a problem.


    This doesn't prove *anything*.

    > Is there an issue with xlC and singleton's in an archived library?


    The aix linking model and aix linker are more similar to Win32,
    than to the rest of UNIXes. Whether you are doing something wrong,
    or the AIX linker is, I can't tell from your description.

    Your best bet is to create (and post) a trivial example, showing
    how your code "works" on Linux and "fails" on AIX.

    Cheers,
    --
    In order to understand recursion you must first understand recursion.
    Remove /-nsp/ for email.

+ Reply to Thread