C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Calling C++ functions in a .so directly from foreign languages and C++ as an interface definition language

From: Adrian Johnston <adrian3_at_[hidden]>
Date: Sun, 31 Aug 2025 07:57:46 -0700
The nanobind project has a page talking about how all past attempts
were a complete disaster. I thought nanobind needed a huge warning
sign too. At least I got it to compile before giving up on the compile
times on my old laptop.

https://nanobind.readthedocs.io/en/latest/benchmark.html

Python is perfectly capable of calling C++ destructors directly
without needing a C++ wrapper and I had that working too. I am still
offering to write up the remaining requirements.

On Sat, Aug 30, 2025 at 9:15 PM Paul Caprioli <paul_at_[hidden]> wrote:
>
> > Nota Bene: There was one bug I can't fix with the current design of
> > C++ and Python. Returning a class by value will result in it being
> > destructed without being copied first.
>
> Pybind11 and nanobind handle these kinds of ownership issues.
> For example, they arrange to call the C++ destructor when Python frees the object.
> There's much more going on than name mangling.
>

Received on 2025-08-31 14:57:59