-
Notifications
You must be signed in to change notification settings - Fork 70
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
Support compiling Happly without RTTI. #41
base: master
Are you sure you want to change the base?
Conversation
Hi! This seems very cool! I've never dealt with this before, so just to check my understanding: some compilers don't support RTTI, which is used under-the-hood e.g. when calling If so, I love the idea of being able to compile on more systems, but I'm a little wary of adding build-time complexity to what should be a simple header-only library, I see a bunch of compiler-specific variables and macros. I'm worried that some day in the future some compiler will choke on this block
or it would need to be updated for future compilers, etc. Is this concern valid? On that note, is there any downside to just always using the alternate |
I think most compilers support RTTI. The use-case I have here is we wanted to compile code to wasm, and disabling RTTI (via the The block of code that detects whether RTTI are enabled with the current compiler is taken from OneTBB. You can also look at how the BOOST_NO_RTTI macro is implemented, using the same compiler-specific macros. It should work on all major compilers/platforms, but I can help setup a more comprehensive CI matrix with GitHub Actions if you want (idk if your Travis CI is still functional, I don't see where the jobs are going?). Note that in the worst-case, none of those macros are defined and
Unfortunately yes. It wouldn't work across DLL boundaries (when compiling Happly in a separate dll and loading it via Anyhow, let me know how you want to proceed :) |
Ah, thank you for the explanation! I see the value of this, but I think it is very important to keep the core library as simple and low-maintenance as possible, and I'm a bit worried about the complexity-add here. How about we create a |
(fyi the CI fixed now, it's updated to use github actions) |
¯\(ツ)/ It's your library, so it's your decision in the end. If you don't foresee any big change in the future then imho keeping everything in the same place will make it easier to maintain than having to backport every bugfix into a separate branch. Apart from the I could get rid of the ifdef block around these lines by defining |
2486e7e
to
2852734
Compare
I've updated the PR to fix conflicts and implemented dummy classes to reduce the number of ifdefs in the code. Let me know if this is less intrusive this way. |
Hi @nmwsharp. Have you had a chance to look at the latest version of this PR? I believe it should be less intrusive now. I'd really prefer to avoid having to maintain my own fork/branch of this project. |
I needed to compile Happly for a wasm project that wants to be compiled without RTTI, so this PR allows supporting this configuration. It comes with a custom RTTI implementation based on LLVM-style RTTI, but because they have some limitations compared to compiled-generated RTTIs (mostly when loaded across DLL boundaries), this alternative is disabled by default (and only used when RTTI are not available).