Closed chriswailes closed 12 years ago
Possible, I'll look into it. Which header are you trying to process?
Sorry, but I can not reproduce your problem. ffi-gen is made for processing C-headers, so there shouldn't be an extern "C" {}
(or it should be removed by the preprocessor).
I'm trying to generate C bindings for C++ code, which requires that I place some of my function declarations inside extern "C" {}
blocks. You can find the code here.
Still, ffi-gen is meant to process C headers. You need to filter C++ stuff with preprocessor instructions, so that the processed header will look like a simple C header:
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
You may also look into the Core.h of LLVM, they have done the same thing there.
That's what I ended up doing and now everything is working fine. I'm glad that there was a solution that didn't involve a bunch of code duplication.
It doesn't look like FFI-Gen currently generates bindings for functions defined inside
extern "C" {}
blocks.