C bindings and wrapper generator for Python using CFFI library
-
Create new directory
my_lib
in cBinder directory -
Create files
test.c
andtest.h
in above directory://test.h int add(int a, int b); float addF(float a, float b);
//test.c #include "add.h" int add(int a, int b){ return a + b; } float addF(float a, float b){ return a + b; }
-
Open terminal/command prompt in cBinder directory and run following command:
python main.py my_lib -f./my_lib -d./my_lib/out compile
-
Now go to
my_lib/out
directory. Indist
directory you will find distribution packages ready to be pushed to PyPi.
Wrapper for test functions lies inmy_lib
directory -
Open up Python terminal in
my_lib/out
directory -
Test generated wrapper
>>>import my_lib.test >>>my_lib.test.add(1,2) 3 >>>my_lib.test.addF(1.0,2.0) 3.0
libamtrack with corrected doxygen comments: https://github.com/certaindividual/library
Copy these external dependencies:
libgsl
libgslcblas
Use this call:
python main.py
libamtrack {name of output folder}
-f
/some-path..../libamtrack/library/src {.c files}
-f
/some-path..../libamtrack/library/include {.h files}
-d
some-results-path {path to folder with results}
-es
path-to-export symbols {path to export symbols list}
-mono {create one file}
libAT {name of final library}
compile {compiling mode}
-i
path-to-external-dependencies-headers (libgsl, libgslcblas)
-i
path-to-libamtrack-headers
-b
path-to-external-dependencies-libraries (libgsl, libgslcblas)
-l
gsl
-l
gslcblas
-l
m