dspatch icon indicating copy to clipboard operation
dspatch copied to clipboard

[Plugin Load] How do we distinguish between debug and release libraries?

Open zmoth opened this issue 2 years ago • 3 comments

Hello, As the title says, the cause is that when I load the release lib using debug it crashes, and vice versa.

Is there already a way to distinguish between debug and release in this project?

thanks.

zmoth avatar Feb 07 '23 01:02 zmoth

Nothing built into DSPatch no. What would you suggest?

MarcusTomlinson avatar Feb 08 '23 06:02 MarcusTomlinson

Sorry, I don't have a good idea. But I looked at the Qt source code and it is in a metaData and library binding, the metaData is essentially a json file. There is a debug item that writes true or false and then determines when the plugin is loaded dynamically.

{qtpath}/Qt/5.15.2/Src/qtbase/src/corelib/plugin/qlibrary.cpp -- 794

uint qt_version = (uint)metaData.value(QLatin1String("version")).toDouble();
bool debug = metaData.value(QLatin1String("debug")).toBool();
...

#ifndef QT_NO_DEBUG_PLUGIN_CHECK
    } else if(debug != QLIBRARY_AS_DEBUG) {
        //don't issue a qWarning since we will hopefully find a non-debug? --Sam
        errorString = QLibrary::tr("The plugin '%1' uses incompatible Qt library."
                 " (Cannot mix debug and release libraries.)").arg(fileName);
#endif

zmoth avatar Feb 08 '23 07:02 zmoth