https://github.com/m32/cindex2ctypes
Using LLVM cindex to generate ctypes bindings
https://github.com/m32/cindex2ctypes
clang ctypes generator python wrapper
Last synced: 2 months ago
JSON representation
Using LLVM cindex to generate ctypes bindings
- Host: GitHub
- URL: https://github.com/m32/cindex2ctypes
- Owner: m32
- License: mit
- Created: 2024-08-07T22:20:58.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-08-17T22:32:43.000Z (9 months ago)
- Last Synced: 2024-12-27T20:23:59.701Z (4 months ago)
- Topics: clang, ctypes, generator, python, wrapper
- Language: C
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Description
The cindex2ctypes is a project to generate python bindings for C code using clang python bindings.
# Dependencies
**C++**
`sudo apt install -y clang-16 python3-clang-16`**Python**
`sudo pip install -r requirements.txt`# Demonstration
Run: `gcc -fPIC -shared -o democ.so democ.c`
Run: `python3 cindex2ctypes.py demo`
The binding code will be available in `demo.py` file.
Run: `python3 demo-main.py`
Output:
```
do_something called with: p1=0x7efd099a2800 c1=49 c2=50 s1=3 s2=4 i1=5 i2=6 l1=7 l2=8 f=9.000000 d=10.000000
cb called with: 0x1234, c_int(5)
p1.proc1 result: 0x1234
do_something returning: 132
do_something result: 132
voidproc called
```