91 questions
1 vote
0 answers
51 views
How to export a member of a member of a class
Given classes and their members: struct A { int member; }; struct B { A a; }; I can use nanobind to export member of a as: NB_MODULE(foo, m) { nanobind::class ::_<B>(m, "B&...
0 votes
1 answer
92 views
How to correctly initialize ctypes char***?
I'm using ctype to call C code from Python. The C function I need to call takes a char***, and so it's bind as using a ctypes.POINTER(ctypes.POINTER(ctypes.c_char)). I don't understand how I should ...
1 vote
0 answers
276 views
Correct & concise way to use PyO3 Bindings (similar to pybind11)
Say I have the following C++ Date class. Using pybind11 I can easily wrap it to be used in Python: /* date.hpp */ class Date { public: int year, month, day; Date(int year, int month, int ...
2 votes
0 answers
561 views
Nanobind C++ passing Python type to Cpp function and use it for casting
I'm creating a C++ class that handle the values passed by the client in a JSON (converted in a dict with json.loads), I make a Cpp class named Parameter and I need to pass a type to the constructor to ...
2 votes
1 answer
278 views
How can I convert a nb::handle (or nb::object or PyObject*) into a nb::ndarray?
Nanobind has a function nb::ndarray_check(handle h) which returns true in case h is usable as an ndarray (e.g. if it implements the buffer protocol). How do I actually create an instance of nb::...
0 votes
0 answers
80 views
using functional pointers( C style ) with pybind
How to use functional pointers(C style) with pybind to implement callback functionality.The c++ code has to call the python function . I am encountering errors related to type conversion when trying ...
0 votes
0 answers
114 views
How to generate a 'stub' Python interface for a 3p library for development?
I'm developing for RPi. I'd like to do the majority of my coding on a fast, local machine with a snappy IDE. To do this, I need to be able to pip install the same modules as I have on the RPi. Problem ...
0 votes
0 answers
99 views
How to pass custom Python Object to a C function exposed by CFFI?
I have this C library that I want to create a Python binding for. I chose CFFI for this task. In this lib of tens of functions, some takes void* as an input. As the lib imply, you can actually pass ...
1 vote
1 answer
123 views
Has anybody attempted to update the Python bindings of LibHaru for Python 3.9 (64 bit)?
I am running Python 3.9, 64bit, and have compiled libharu and some extensions into a DLL, including libpng, with VS 2022. The DLL can load into Python after adding minimal code tweaking to find the VS ...
5 votes
1 answer
814 views
RPATH propagation failing for Python bindings
I am building a library (Ubuntu 22) that uses onnxruntime under the hood. In turn, onnxruntime uses CUDA, dynamically loading some dedicated "backend". I build the whole code stack except ...
0 votes
1 answer
153 views
Initializing std::map of pointers of objects in cppyy
I am trying to initialize a map from strings to unique pointers from cppyy. I am able to make a vector of pointers without issue, but I get some complaints from cppyy when I make a map. Here are my ...
3 votes
1 answer
159 views
Using cppyy with rvalue pointers and maps
I would love to love cppyy. However the codebase I am using has heavy use of std.unique_ptr, rvalue pointers, and templates. I am confused about how to translate these into something I can call from ...
0 votes
1 answer
187 views
How to use pybind11 to call hpx async function in recursive python code?
So , what I want to do is to call this async function in the recursive function in python . But it is not working and I dont have idea why it shouldn't . This is my binding for async function in hpx ...
1 vote
1 answer
136 views
Embedded a #[pyclass] in another #[pyclass]
I am trying to implement a cache for the private variable of any python class. Let's suppose I have this: #[pyclass] struct ClassA { pv: Py<PyAny>, // GIL independent type, storable in ...
0 votes
1 answer
789 views
Creating Python bindings for CPP code and then importing it into a Python script
I'm trying to make Python bindings for some C++ code that I created using an existing C++ library. I'm using PyBind11 and CMake to build the bindings and convert them into a shared library (.so) that ...