Comments (10)
... so that should probably be converted to:
alias tibrvMsgData_Encoder = tibrv_status function(
char** wire_buffer, tibrv_u32 mem_available, tibrvMsgField* field);
from dstep.
Clang cannot compile that code, that's also what the error says 😉. It seems it cannot find tibrv_status
. I think Clang uses int
here as a form of default type.
from dstep.
Oh, so that could have happened because I was converting each header one by one? The status thing is just a typedef defined in another header that gets included. This hasn't caused problems with anything but this issue though.
from dstep.
You basically need to convert the headers one by one. That's only what's currently supported by DStep. C is a very annoying language in this area. If a given header is always included together with other headers it could very well be that this header is using symbols from other headers but is not explicitly including them itself. Personally I would say that is a broken design.
If this is the case I would recommend you contribute a fix to the project, if it's open source. Otherwise you could just add the missing includes when running DStep on the files and then remove them.
Hmm, I'm wondering if it's not able to find a header file, but in that case it would say so. In that case you need to use the -I
flag to indicate where it can find the header files.
I just noticed that Clang has the a flag that could be useful
-include <file> Include file before parsing
from dstep.
Yea. I wonder if one could figure out a correct merge order based on local #include "..."
directives from a set of header files? And then just dump everything into a single huge D module. There's many issues if you do it one by one and then try to merge it manually -- for instance, I had to fix a good number of Anonymous_0
, Anonymous_1
name clashes (see #8). Or issues like the one above.
from dstep.
I updated my comment above.
from dstep.
The idea is that you should not merge the D modules. You need to manually add import
-statements instead. That's something DStep doesn't handle automatically.
from dstep.
In regards to the original question, indeed, the tibrv_status
was defined in the file that wasn't directly included in the target header file (status.h
), so one would need to pass the -include
flag, as @jacob-carlborg has pointed out above:
dstep handler.h -o handler.d -include status.h
which would then correctly generate
extern(C):
alias function (char**, uint, tibrvMsgField*) tibrvMsgData_Encoder;
Perhaps this could be put in the docs as it happens very often in C libraries.
from dstep.
Personally I think this is a workaround and not a solution. I think it's a broken design of the header files. But I put it in the documentation anyway.
from dstep.
@aldanor I added a section for limitations/known issue to the readme: https://github.com/jacob-carlborg/dstep#limitationsknown-issues.
from dstep.
Related Issues (20)
- `--normalize-modules` insert underscore in the module decl but not in the filename
- typedef function prototypes don't retain arguments HOT 5
- dub run failure - ld cannot find @linker_flags.txt HOT 4
- doc error:
- Missing import HOT 2
- Unhandled type kind objCTypeParam HOT 2
- const T arr[] gets converted to imcompatible const(T) *arr instead of a warning HOT 2
- Improper output when importing core.stdc.limits HOT 1
- Rename enum members can create invalid enum names HOT 1
- API macro erased but should be extern(System) HOT 2
- /usr/include/cuda_runtime_api.h ==> d: Error: undefined identifier `cudaError_t` HOT 6
- Assertion Failure when defining a cast from int to function pointer
- Unhandled type kind objCObject when trying to bind Foundation.framework on macOS
- enh? add enum alias (as dpp do) HOT 1
- unknown type name 'size_t' HOT 1
- `--alias-enum-members=true` shouldn't affect global anonymous enums
- Unnecessary leading dot in alias
- Add support for adding public imports
- Missing `__u/int128` support HOT 13
- How to use dstep generate PostgreSQL & MySQL binding? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dstep.