C++ And Loaded Code And Static Lib

  • I have a static library that I've built.  This library consists of
    mostly C++ classes in a separate namespace (call it MyNameSpace).

    I also have two pref panes (think of them as Code bundles that get
    loaded into an app).  Both of these pref panes statically link with
    my library.

    However, when the second pref pane/code bundle is loaded, it uses the
    classes loaded from the first pref pane/code bundle (even if the
    classes have different implementations but the same names).

    How do I get each pref pane/code bundle to use the classes it linked
    with, rather than looking them up from previously loadded code?

    I knew this was a problem with Objective-C, but I had though C++
    didn't have this problem.

    Thank you muchly, this a huge problem for me.

    SD.
    --
    =========================================SD

    WARNING: Programming may be habit forming.
  • On Fri, Apr 16, 2010 at 12:25 PM, SD <macosxdevlist...> wrote:
    > How do I get each pref pane/code bundle to use the classes it linked with,
    > rather than looking them up from previously loadded code?

    Shouldn't two-level namespaces solve this problem?
    http://developer.apple.com/mac/library/documentation/DeveloperTools/Concept
    ual/MachOTopics/1-Articles/executing_files.html


    --Kyle Sluder
  • Wow, twisted stuff.

    One of my API extern C functions was using some functions that had
    the inline keyword on them.  When using inline, the wrong someFunx()
    gets called.  Remove the inline and it seems to work fine.

    What a waste of a day.

    -----------------------------------------------------------
    inline void someFunx()
    {
      someOtherFunx();
    }

    extern apiFunx()
    {
      //calls the wrong someFunx() if inline used on someFunx()
      someFunx();
    }
    -----------------------------------------------------------

    Thanx for the responses, hope this helps someone in the future (come
    get me Google).

    SD.

    ______________________________________________________________________
    Previous message from SD on 4/16/10 at 12:25 PM -0700
    **********************************************************************
    > I have a static library that I've built.  This library consists of
    > mostly C++ classes in a separate namespace (call it MyNameSpace).
    >
    > I also have two pref panes (think of them as Code bundles that get
    > loaded into an app).  Both of these pref panes statically link with
    > my library.
    >
    > However, when the second pref pane/code bundle is loaded, it uses
    > the classes loaded from the first pref pane/code bundle (even if the
    > classes have different implementations but the same names).
    >
    > How do I get each pref pane/code bundle to use the classes it linked
    > with, rather than looking them up from previously loadded code?
    >
    > I knew this was a problem with Objective-C, but I had though C++
    > didn't have this problem.
    >
    > Thank you muchly, this a huge problem for me.
    >
    > SD.
    > --
    > =========================================> SD
    >
    > WARNING: Programming may be habit forming.
    > _______________________________________________
    > MacOSX-dev mailing list
    > <MacOSX-dev...>
    > http://www.omnigroup.com/mailman/listinfo/macosx-dev

    --
    =========================================SD

    WARNING: Programming may be habit forming.
previous month april 2010 next month
MTWTFSS
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30    
Go to today