This software generates a Python ctypes
wrapper from C header files of
libraries. The motivation for this work is to quickly wrap entire libraries or
software into Python 'quickly' while giving users full/significant control over
what data structures and functions they wish to wrap.
- Bash
- GCC -- for now; workaround is possibly easy: Change the compiler in the bash script.
Create and maintain an input file named htopy_input.py
for use with htopy
.
This file must contain lists that identify the C data structures that you want
to be wrapped into your Python interface. Note that there may be
OS/architecture-dependent data types which, you may yourself have to dig into
for your system and find the base type of. See the examples for help.
List of features that are ready:
- Partially automates writing the
ctypes
-wrapped headers - User decides how deep the C code is wrapped into Python
- Compiler-flag-dependent structs can be smartly dealt with
- With some clever hacks, significant chunks of C++ can also be wrapped
To-do list:
- Complete automation is the ultimate goal
- Automate dealing with OS/architecture-dependent data types
- Enable options to use compilers other than GCC
- Make the source code Python-version-independent
Project is: in progress.
The licensing spirit of this code is very much same as that of
SWIG, that is, the htopy
source code is to
remain GPL'd, whereas htopy
output is free for users to use based on their
choice/requirements. Note that the htopy
-generated output code for your input
C software may be governed by the licensing terms of that C software.
The htopy
source code is licensed under the terms of GNU GPL v3.0. See the
LICENSE file
in the main/root directory of this repository, or visit
https://www.gnu.org/licenses/ for details.
- Gajanan Choudhary - website
ctypes
documentation- Stackoverflow