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

Using this in an environment without RTTI? #340

Open
retroandchill opened this issue Jun 19, 2024 · 1 comment
Open

Using this in an environment without RTTI? #340

retroandchill opened this issue Jun 19, 2024 · 1 comment

Comments

@retroandchill
Copy link

I'm currently using this library for mocking functionality on an Unreal Engine project, but the problem I'm running into is that to use this library I need to enable RTTI, however, Unreal Engine prefers to have it off. I ended up enabling it for my code, but it seems like for some reason the mixed environment with RTTI on in some DLLs and off in others is causing issues. My question is, how big of a lift would it be to completely strip all uses of RTTI/dynamic_cast from this library to allow for it to be used in situations where that is disabled?

@FranckRJ
Copy link
Collaborator

FranckRJ commented Oct 6, 2024

After looking a bit a the code I'd say that it wouldn't be trivial to remove the use of RTTI in the lib, but it doesn't look that hard. It seems to me that most uses of dynamic_cast are not really needed (e.g. we pass a generic type to a function, like Destructible*, then we dynamic_cast it to IMatcher*, but the function only works with IMatcher* anyway so we should be able to use that type as the parameter of the function), and for the others uses we could remove the dynamic_cast by replacing "if a is type T do that, else if a is type U do that" by a call to a virtual function (this kind of stuff is done in the event formatter ).

There's probably more to it, but it looks doable.

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

No branches or pull requests

2 participants