Since it's all code-generated anyway


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:

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.


That’s great, my point is the interfacing Python/Cython boilerplate code could be generated alongside the C++.


Does that just mean a type that is also available in C?


Much like Rcpp, ctypes does some magic to let you call functions within a dynamic library from python.