Important: Please read the Qt Code of Conduct -

Dynamic Libraries Static Objects - Linux

  • Hi all,

    I currently have a singleton defined in a shared library:
    @InstanceStorage& InstanceStorage::instance()
    static InstanceStorage instance;

    return instance;

    .pro file: @CONFIG += shared@

    I attempt to get the instance of this class in two separate locations:

    • Another Shared Lib
    • A dynamic plugin

    What I'm noticing is that the instance memory address is different in both locations. Any ideas why this might be the case and how I might resolve it?

Log in to reply