There are two approaches that have been tried here:
- Use SWIG to wrap the functions declared in ghostpdl:psi/iapi.h. This done by ghostpdl:toolbin/gsapiwrap.py
. This hasn't been entirely succesfull - SWIG is surprisingly limited at dealing with APIs that use (argc, argv) parameters, out-parameters and function pointers. So we end up with lots of manipulation in the SWIG .i file, plus custom front end (e.g. Python or C#) code to make things work.
- Use python ctypes. This works pretty well. See ghostpdl:toolbin/gsapi.py
, a self-contained python module that, as of 2020-Jun-29, provides all of the ghostpdl:psi/iapi.h
API except for gsapi_add_fs() or gsapi_remove_fs(). The drawback here is that it is specific to python - equivalent code would have to be written for each front-end language that is required.
--
Julian Smith - 2020-06-29
Comments