Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zmoth opened this issue Feb 7, 2023 · 3 comments
Open

Comments

@zmoth
Copy link

zmoth commented Feb 7, 2023

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.

@MarcusTomlinson
Copy link
Member

Nothing built into DSPatch no. What would you suggest?

@zmoth
Copy link
Author

zmoth commented Feb 8, 2023

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

@mhandb
Copy link

mhandb commented Oct 7, 2024

It would be better to have a plug-in interface which is stable regarding the ABI.

Here the issue is not specific to debug/release mismatch. But about the binary compatibility, the CRT or a compiler mismatch can crash in the current plugin design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants