I have followed this tutorial to create an FFI interface to some C code to torch
However, it doesn't work for C++ functions. Is it even possible, if so how?
I created a shared library from the C++ file (simple.cpp) like so:
g++ -Wall -shared -fPIC -o libsimple.so simple.cpp
The C++ functions need to have C linkage to be used via FFI. Wrap the function signatures with extern "C" calls. More details here: In C++ source, what is the effect of extern "C"?