/ocaml-ctypes-python-extension-example

Example showing how to write a Python extension module in OCaml using ocaml-ctypes.

Primary LanguageOCamlMIT LicenseMIT

Example showing how to write a Python extension module using ocaml-ctypes, based on ocaml-ctypes-inverted-stubs-example.

Install OCaml dependencies

opam install ctypes-foreign ctypes

and a working python3 installation, eg. on ubuntu, it will be something like:

apt-get install python-dev

Build the example extension (pymod.so)

make

Run Python tests on example extension

python3 tests.py
  • tested on python-3.6.5 but should work on recent python3 releases.