https://github.com/tmcclintock/cffi_example
This is a working example of how to use cffi when you have a bunch of already written .h and .c files that you want to bundle into some python code without using ctypes.
https://github.com/tmcclintock/cffi_example
Last synced: 4 months ago
JSON representation
This is a working example of how to use cffi when you have a bunch of already written .h and .c files that you want to bundle into some python code without using ctypes.
- Host: GitHub
- URL: https://github.com/tmcclintock/cffi_example
- Owner: tmcclintock
- License: mit
- Created: 2017-08-09T03:45:59.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-19T15:35:47.000Z (over 6 years ago)
- Last Synced: 2024-12-28T08:50:16.558Z (5 months ago)
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cffi_example
This is a working example of how to use cffi when you have a bunch of already written `.h` and `.c` files that you want to bundle into some Python code without using ctypes.This repo should be used as a template for anyone that wants to write faster code or wrap their C code, but doesn't want to deal with following the regular cffi examples or fiddling with ctypes.
The gist is the following:
1) Have a directory structure similar to this one, with a `src`, `include`, and `project` directory.
2) Use `setup.py` to compile everything and link the python package with the `.so` file created.
3) Use `__init__.py` to access your library when you do an import.That's it. In this project you can get everything working immediately by changing `mycffi` to whatever project name you need.