-
We have a very large production C++ code base, which continues to be under active development. We use nanobind extensively for mutual language bindings between C++ and python. All of our application software, whether written in C++ or python, uses exactly the same underlying core libraries. Has anyone tried using nanobind with Codon? I'd be very interested in how it went for you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @smcdow, I haven't tried nanobind specifically, but it should work out of the box if using Codon's JIT mode or Python extension backend, since those modes integrate directly with standard Python. However, it's pretty straightforward to call Codon directly from C/C++; see https://docs.exaloop.io/codon/interoperability/cpp. In short, you can write a function in Codon annotated with |
Beta Was this translation helpful? Give feedback.
Codon uses its own ABI (which is essentially just the C ABI) that's totally independent of CPython's. So you're right that nanobind / pybind won't work unless you go through CPython first and then call Codon from there, either as a JIT or Python extension. If you wanted to call C/C++ directly from Codon without going through CPython, you could do so with
from C import
(currently supports plain C /extern "C"
, but we're planning to support C++ natively as well in the future).