Comments (14)
If you can point me in the place in the code where it handled - I can try to fix/improve by myself. Thank you!
from ctypeslib.
that seems to be an llvm/clang error message. the most probable explanation is that the include path does not contain the user headers' include folder.
try using --clang-args="-I/usr/your/path/to/headers/files/" ?
from ctypeslib.
added those, doesn't seem to help. See how I did it in my script http://xvilka.me/genbind.py.txt
from ctypeslib.
I confirm it's an include path issue.
@XVilka try clang_opts = ["-I/usr/local/include/libr/", "-I/usr/local/include/", "-I/usr/local/include/libr/include"]
From a clean radare2 git repo I was able to make the "angled error" disappear:
radare2$ clang2py ./libr/include/r_core.h --clang-args="-I ./libr/include/"
I do not know where your libr includes are installed, but if you add the folder containing r_userconf.h to the Include path, it works.
from ctypeslib.
@trolldbois all files are located in /usr/local/include/libr/
, both r_core.h
and r_userconf.h
.
from ctypeslib.
XVilka, try to use clang to parse the radare headers.
clang-5.0 -E libr/include/r_core.h
That usually produces the error you reported because the include path is lacking.
The fix is :
clang-5.0 -E libr/include/r_core.h -I./libr/include/
So when you have a working clang command line, you will have a working ctypeslib command line
from ctypeslib.
Interesting thing that clang line works for me, while ctypeslib - doesn't.
from ctypeslib.
Can you reproduce an error with clang2py ?
Or are you saying your code that uses ctypeslib doesn't work ?
.
from ctypeslib.
Your code has the following error:
clangparser.Clang_Parser(flags = [])
Flags should not be empty.
from ctypeslib.
@trolldbois took a line from your examples.
from ctypeslib.
@trolldbois yes, if I call clang2py --clang-args="-I/usr/local/include/libr" /usr/local/include/libr/r_core.h
everything works OK. Very strange.
from ctypeslib.
So if you change your code a bit like this https://gist.github.com/trolldbois/af7fee01b1afa13a74c196fefceeda93 it will work .
The clang parser is the class that need the Include command line options. Not the code generator.
Can you point me to the example you used so I can double check it on my side ?
from ctypeslib.
@trolldbois Thank you! That indeed solved the issue. Can't find where I saw this, maybe I just misread it...
from ctypeslib.
Great !
from ctypeslib.
Related Issues (20)
- Multiple errors when trying to use ctypeslib2 instead of ctypeslib HOT 11
- Confusing INFO HOT 1
- What's all about WORD_SIZE, POINTER_SIZE and LONGDOUBLE_SIZE? HOT 1
- Does ctypeslib2 address the same concerns as ctypesgen? HOT 1
- Request: common definitions in separate import
- Request: identify "top level" structs
- Parsing a variadic macro makes clang2py crash HOT 1
- Define with parenthesis not parsed HOT 1
- clang2py not installed in "/usr/bin" HOT 1
- define didn't convert to python HOT 1
- Add if Windows 32bit use WinDLL instead CDLL HOT 1
- Use of "-r" option makes clang2py crash HOT 2
- do not support enum without name HOT 3
- Arithmetic macro not evaluated HOT 1
- _fields_ is final because the structure is used before _fields_ is defined. HOT 1
- Enum wrong generation within included headers HOT 1
- Better union generation
- Fails on variable of enumaterated type
- Can't tell if a char array is const or not
- ran clang2py on a header that had the "raise" symbol HOT 2
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 ctypeslib.