exaloop / codon

A high-performance, zero-overhead, extensible Python compiler using LLVM
https://docs.exaloop.io/codon
Other
13.95k stars 498 forks source link

how can I add plugin #520

Closed lilothar closed 5 months ago

lilothar commented 6 months ago

I wander that if I have implement a tensor compute library, as a example, expose a interface like 'l2_norm(const std::vector &v)`, how can I add it to the codon stdlib for a extension, and call it via python, finally, generate code or library call the interface?

inumanag commented 5 months ago

I am afraid I do not understand the question completely.

If you want to use C/C++ FFI from Codon, you will need to expose the C/C++ functions via extern C interface and avoid C++-specific objects in signatures (such as vector).

If you thought of something else, please let me know.

lilothar commented 4 months ago

yes , I known the method extern C, but it is complete not esay to expose too many apis, I wander if there is simple way to expose as pybind11 to expose a c++ class