-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
importc
fails to generate stub type
#24604
Comments
but why |
because the type is being imported from C (and defined in a C library) |
Yet you want it to occur in the produced C file so as far as the compiler is concerned you export it... |
well, that doesn't seem logical - that would place the responsibility of defining the type on nim, which is not the intent. The type is defined in a C library - what nim is supposed to to is create an opaque struct to be used for pointers but whose definition remains unknown to the compilation unit - nothing else. In fact, this is also what happens, typedef struct MyType MyType;
struct MyType {
char dummy;
}; |
Hmm ok, I get what you're saying. |
It seems that lots of codebases relies on |
hm, that's an unfortunate mess - the manual seems pretty clear on the intent of nodecl / header here, in favor of the interpretation of this issue, so technically such code is buggy (as buggy as the compiler :) ).
|
Well the issue is subtle, "this type comes from C but also generate it in the C code" ... it's no wonder why we never encountered it before. |
I think it's mostly because most of the time, people tend to use In this particular case, there's actually no |
Description
My expectation, since there's no
nodecl
, would be a stub type generated (typedef struct MyType MyType;
or similar.Nim Version
devel
, 2.0Current Output
Expected Output
No response
Known Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: