Skip to content
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

va_list missing import #34

Open
jamesmahler opened this issue Jan 13, 2015 · 3 comments
Open

va_list missing import #34

jamesmahler opened this issue Jan 13, 2015 · 3 comments

Comments

@jamesmahler
Copy link

When there are va_list references in the .h file... you need to import core.stdc.stdarg in the resulting d file.

This may have moved at some point... as I get a superfluous import core.stdc.stdio;

@jacob-carlborg
Copy link
Owner

Currently there's a hardcoded list of C header files that dstep knows how to map to D files. The problem is there's a big chance a given symbol is not actually defined in any of these files but instead is defined in an internal header file, which will be different for different compilers and platforms. Then the internal files is included in one of the standard C header files.

I can take a look at this particular case. Do you have a code example I can use?

@jamesmahler
Copy link
Author

I don't seem to be able to recreate it with simple cases. Both of these work.

#include <stdarg.h>

void function(va_list args);

and

#include <stdarg.h>

struct Example {
        int (*Ex)(va_list args);
};

When running either of the above, I get the correct import

import core.stdc.stdarg;

however when running on a real file, I do not get that import.

The actual file I'm trying to do is jni.h. Not sure if that's the exact same file. Mine is from OpenJDK 1.7.0_65. If you look at the JNINativeInterface_ struct, that is where all the va_list references are.

@jacob-carlborg
Copy link
Owner

I noticed that if I use an old version of libclang it will not have the file information of where va_list is declared. Then I tried a later version and the would properly include import core.stdc.stdarg; when running dub on jni.h.

So I guess it depends on which version of libclang you're using. Then one which worked for me was the one included in Xcode 6.1.1. That is libclang.dylib (compatibility version 1.0.0, current version 600.0.56). I guess this is an Apple version, I'm not sure which version of standard libclang this corresponds to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants