Questions tagged [cppyy]

cppyy is a Python module for using C++ code inside python.

cppyy is a Python module for using C++ code inside python.

59 questions
8
votes
1 answer

How to Implement Python Interfaces for C++ Libraries

What is the best/standard way to create Python interfaces for C++ libraries? I know this question has been asked on here before but that was in 2008 and things may/likely have changed since then. I've looked around and tested a few different methods…
La Fon
  • 145
  • 1
  • 1
  • 9
7
votes
1 answer

Is there *any* solution to packaging a python app that uses cppyy?

I'm no novice when creating cross-platform runtimes of my python desktop apps. I create various tools for my undergraduates using mostly pyinstaller, cxfreeze, sometimes fbs, and sometimes briefcase. Anyone who does this one a regular basis knows…
TSeymour
  • 729
  • 3
  • 17
3
votes
1 answer

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 python. For instance, I am stuck on how to create…
shouriha
  • 79
  • 6
3
votes
1 answer

Cppyy cmake build unable to find LibClang

I've been trying to use cppyy to build some python bindings for a C++ library. At the moment I am using the cookiecutter recipe from here: https://github.com/camillescott/cookiecutter-cppyy-cmake But the package is having trouble finding…
3
votes
1 answer

Can I get the AST from cppyy

I want to get access to the AST within cppyy before the python bindings are created. I'd like to use this to generate other kinds of bindings. I have seen cppyy-generator, but it requires a separate installation of clang on the machine. Since cppyy…
Ken
  • 693
  • 1
  • 7
  • 15
3
votes
1 answer

cmake to bazel - cppyy - shared libraries and includepath

I wanted to use the macro cppyy_add_bindings from FindCppyy.cmake. I have to add this in a cpp/python using bazel project. How do I handle the library dependencies? Do I have to load all libraries explicitly in the py file, or is it possible to have…
user9092688
  • 171
  • 10
2
votes
1 answer

cppyy crash with uint8_t arrays

With cppyy 2.3.1 and python3.8, I could do the following: import cppyy cppyy.cppdef(''' struct T { uint8_t t[10]; }; ''') t = cppyy.gbl.T() bytes(t.t) With cppyy 2.4.0 and above, I get a sigsev: #8 signal handler called #9 …
fab
  • 55
  • 4
2
votes
1 answer

illegal instruction on aws batch

I'm trying to submit a demo job to batch compute that tests if I can properly use a python module "cppyy". However, I received "illegal instruction" core dump error. Interestingly, I didn't receive any error message if I run the job at a container…
Max Wong
  • 694
  • 10
  • 18
2
votes
1 answer

Type alias arguments in cppyy

I'm trying to use some C++ libraries in Python code. One issue I've had is I can't seem to call functions that take an aliased type as an argument. Here is a minimal example I've reproduced: import cppyy cppyy.cppdef( """ using namespace…
2
votes
1 answer

Exception at `import cppyy` on macOS Catalina or Big Sur

Pretty simple explanation - I can pip install copy but import cppyy in any python file throws a whole lot of exceptions: (Re-)building pre-compiled headers (options: -O2 -mavx); this may take a minute ... ERROR in cling::CIFactory::createCI():…
Chris Vandevelde
  • 1,431
  • 17
  • 23
2
votes
1 answer

cppyy inherit class that contains a smart pointer

Here is a simple example of inheriting from a class that contains a smart pointer. We don't do anything with it, just declare it. import cppyy cppyy.cppdef(""" class Example { private: std::unique_ptr x; public: Example()…
innisfree
  • 2,044
  • 1
  • 14
  • 24
2
votes
1 answer

cppyy with std::function) callback

I am using cppyy. I want to pass a function to my C++. The C++ expects a function of signature std::function)>. I don't know how to do it. Here is a minimal example of the error: import cppyy # To be passed to C def…
innisfree
  • 2,044
  • 1
  • 14
  • 24
1
vote
0 answers

Unable to install cppyy on Ubuntu — gmake error 2

I'm trying to install cppyy on Ubuntu (arm64) using a Python installation created using pyenv. gcc, g++, build-essential, and make are installed from the default Ubuntu distribution packages. I have tried two methods to install cppyy, but neither…
Ben Zelnick
  • 433
  • 4
  • 14
1
vote
1 answer

How to define in Python a shared pointer to imported virtual class using cppyy

I have a virtual class in my code: namespace X { class Y { public: /* CTOR */ Y() {}; /* DTOR */ virtual ~Y() {}; /* Initialization */ virtual bool Init() = 0; virtual…
1
vote
1 answer

cppyy OPENMP error: nullptr result where temporary expected

I've been trying to run some parallelised code in C++ from Python through cppyy but am facing an error. The executable (compilted through GCC with -fopenmp -O2) runs without errors and shows the expected drop in runtime from parallelisation. When…
Thejasvi
  • 200
  • 1
  • 11
1
2 3 4