-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
Issue with opaque struct across modules #3817
Comments
This is yet another duplicate of #2782, #1020 etc. - hence closing. ;)
If possible, extract the struct declaration to a separate module and import it from there. |
Does this mean DMD accepting this is a bug? The spec says that opaque structs can be used to implement the PIMPL idiom, but in LDC they're useless? |
It boils down to that you cannot declare the same struct in multiple modules in D. So if the implementation of the struct is in another module, then no, the opaque struct and the impl don't refer to the same type. |
Does LDC support another way of implementing the PIMPL idiom? |
This has nothing to do with LDC per se, this is a general D restriction, it's just that DMD has much less strict codegen checks and according bugs, though one might argue that this |
I'll figure something out, thanks! |
To make things clearer: import a, b;
void main()
{
A inst;
foo(&inst);
} =>
|
I think that yes, it's strange to accept it in the first place. the 2 struct have different fully qualified names. |
We stumble upon the following problem in dkorpel/libsoundio-d#3 (comment)
When built:
But it works in DMD.
This doesn't create problem when module a and b are in different translation units, but typically will be exposed with
dub --combined
.What to do?
The text was updated successfully, but these errors were encountered: