-
Notifications
You must be signed in to change notification settings - Fork 37
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
typedef <typeA> <typeB>; when typeA is not in scope #256
Comments
Thanks.
Yeah, the imports are a known problem.
Cool 😃. It all depends on the C code. For example, the bindings to libclang that DStep is using are completely automatically generated by DStep itself. But for other headers it don't work as well.
You could please show exactly how the two header files look like (with the relevant content).
symbols like
I would need to see the C code in both header files to tell for sure. But in general there are some limitations due to DStep only look at one file at the time. I plan to try to do a whole project analysis, if a whole directory is passed to DStep, the might help here. That could automatically add imports as well. |
a.h: typedef struct {
int x;
int y;
} A; b.h: #include "a.h"
typedef A B; for completeness, c.c: #include <stdio.h>
#include "b.h"
int main(void)
{
printf("noop");
}
extern (C):
alias B = _Anonymous_0; |
DStep used to generate code for extern (C):
struct _Anonymous_0
{
int x;
int y;
}
alias A = _Anonymous_0; That is the most correct representation, but unnecessary. That has been fixed only generate a struct without the alias. But it seems other parts of the code was not updated. |
Other parts of dstep/lib-clang do seem to look across imports, however ; in another conversion I got a warning about duplicate symbols. So it is seems surprising that the |
The anonymous symbol is not needed. |
@jblachly you can try my workaround: feed |
First, let me say that dstep is amazing and my first experience with it today has made me a believer.
Other than needed
import
s, I only had a single problem with a 1700+ line .h file :-OQuestion
I have two C headers, with typeA defined in moduleA (say, modA.h defines struct typeA) and module B #includes this and uses a typedef:
typedef typeA typeB
When translating module B, I would have expected the declaration
alias typeB = typeA
, but instead (because typeA was not in scope), I gotalias typeB = _Anonymous_0
Is there a way for me to mitigate this, or is it intractable as things stand today?
Thanks again for this amazing time-saver.
The text was updated successfully, but these errors were encountered: