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
warning C4275: non dll-interface class used as base for dll-interface class #84
Comments
Note: there is a nice write-up here of possible options to solve this problem: https://stackoverflow.com/questions/24511376/how-to-dllexport-a-class-derived-from-stdruntime-error |
The solution I was planning for fixing this was to not export exception classes (i.e, they wouldn't be declared with However, Clang isn't happy about that. If the class if fully inline, then Clang warns us about the lack of out-of-line virtual method definition, see #24 . But worse than just a warning, I can see that inheritance doesn't work properly. I tested to not use In Windows and Linux, in the https://ci.appveyor.com/project/vgc/vgc/builds/31276308
However, in macOS with Clang, I get: https://travis-ci.org/vgc/vgc/jobs/658880590?utm_medium=notification&utm_source=github_status
Notice how Python doesn't recognize the derived exception type. This does look like a potential problem with the vtable, as Clang warns us. I don't really know what's the proper solution to make both MSVC and Clang happy. Perhaps the exception classes should be inline-not-exported on MSVC, and exported-non-inline on GCC and Clang, which we could implement via some macros, e.g., I couldn't find good examples of what other libraries do. Many don't use exceptions at all (e.g., Google). |
See also: pybind/pybind11#1769 |
When compiling on Windows, we have hundreds of such warnings.
We should either silence it, or, preferably if possible, fix the code so that there are no warnings.
The text was updated successfully, but these errors were encountered: