-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Cross-dynamic library compatibility #9
Comments
I think problem is because you compile it separatelly, so one any type has two different vtable pointers template struct aa::any<CRTP, aa::copy, aa::move>;
... Compile it and link to all other parts. |
I had the same idea (actually I tried explicit instantiation of Though it occurred to me that this comparison is actually only required to enable the bad cast exception. It might be nice if you were able to add an 'unsafe' version/overload for Long term though, I think I should just find a way to avoid passing things over dll boundaries. It's too troublesome in general. |
Another way is to store name of type in vtable and compare names, not pointer to vtable. But it seems too heavy for default behavior |
Hi again, can you check if this solves your problems? |
Sorry for the delay. Just tested now, and yes, this fixes the issue in my case. Though I wonder what guarantees this can give (for example, compiling one dll with MSVC and another with Clang-cl. Considered ABI-compatible, but not sure that would extend to type names? I'm not suggesting you should worry about that, I completely agree that your default implementation is good. But I think even with this option available, I'd still prefer to just be able to do an Somewhat related to that, I'd suggest considering to drop the |
I'm currently working on some things that will improve the situation, the current support is more like showing an opportunity. Performance will also be improved and there will be a polymorphic pointer and reference type that does not own the content, they are easier to pass through interfaces, and the pointer will have a method that returns a raw pointer to value, so you can do an unsafe cast |
Sorry to flood you with issues ;)
This one might be a killer for me on my current project unfortunately; though it's probably not all that surprising, and is not really an issue per-se since this stuff lies outside of the core C++ language.
I'm getting failing
any_cast
s, and I suspect it's caused by putting a value into anany
in one dll, and then trying to extract it within another. I guess the comparison on thevtable_ptr
is the culprit, since presumably each dll has its own copy of the instantiatedvtable_for
template, thus incompatible addresses? My suspicion is this is something that there's really no viable solution for, but maybe you have some ideas for a workaround?Very similar issue with this library, some relevant info in that thread.
The text was updated successfully, but these errors were encountered: