-
-
Notifications
You must be signed in to change notification settings - Fork 271
Fix #4779 - C++ classes need TypeInfo #5014
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
base: master
Are you sure you want to change the base?
Conversation
|
Ok yeah I'm lost. |
4ac9db1 to
1882cc6
Compare
|
Hmm, I set linkage onto |
56c5e91 to
1734fb2
Compare
|
Should probably add a couple of interfaces to verify that they work. One for parent, one for child both in -betterC file. |
1734fb2 to
afcee2c
Compare
|
Added the interfaces. Also checked that the macos failure isn't caused by me, it's in other PR's. |
a7cf98a to
af325f5
Compare
af325f5 to
0008336
Compare
|
You're now switching to the emit-into-every-referencing-object-file TI emission scheme for all classes, and all symbols they reference. Not restricting it to C++ classes, nor as the hacky 'solution' this is for interoperating with separate betterC binaries not exporting any TypeInfos. So this would affect OO code emission quite considerably, and badly as in bad code bloat. Have you considered making your betterC libraries a bit more fine-grained, disabling all the rest except for leaving TypeInfos enabled? I don't expect it would work out of the box, presumably needing some LDC adaptations, but it might be a better solution for the special problem in #4779. |
I can gate it at the end, although I am hoping by not gating it that it'll maybe find some cases with the help of the D classes in testsuite that I won't think of. And yes, I am aware of a testsuite change for D classes that's easily undone.
That would be a valid solution for me, and so is the one I ended up with by templating classes. However the point of ProjectSidero is three fold:
By implementing what amounts to a standard library, I can verify if it's a problem worth solving. In this case I have an example of where somebody tried to mix full D and -betterC together with C++ classes and failed due to linker issues. And that is Andrei with dmd.common. Given that I could confirm that it's a problem worth solving, and I have Andrei as an example, I am confident this needs fixing. |
|
Now that I am thinking about gating beyond simply keeping it an option for later: TypeInfo is really only needed for C++ classes in the following cases (that I can think of):
If it were gated upon reference by another TypeInfo, typeid and D variadics, that may make it PAYG enough to remove the code bloat issues. Would also work for structs. I suspect implementing it may be more than what I can do, though ;) |
I have literally no idea if this is even going to work.
I only managed to find the location that needed changing thanks to GH's web copilot (and promptly burned through an entire month of free credits lol).