I’ve been thinking a little bit about how to deal with interfaces since C++ interfacing is not all that mature for many interpreted languages. Having just spent some time looking at the standalone function magic for Rcpp and how we generate wrappers that are Rcpp-compatible, I think we could just code generate the, e.g., Python code required to use ctypes directly: https://docs.python.org/3/library/ctypes.html#calling-functions
Seems way easier than trying to do something generic like SWIG.
Python, via Cython, interfaces fine with the types in the C++ standard
library. Since any interface already has to wrap the C++ code generated
by stanc-related functions, I would anticipate that generating code
which looks a bit like that would be fine.
This said, projects which will not wrap C++ code generated by
stanc-related functions but will be wrapping the stand-alone functions
might appreciate ctypes compatible code.