cppyy is a Python module for using C++ code inside python.
Questions tagged [cppyy]
59 questions
1
vote
1 answer
How to use future / async in cppyy
I'm trying to use future from C++ STL via cppyy (a C++-python binding packet).
For example, I could run this following code in C++ (which is adapted from this answer)
#include
#include
#include
#include
using…

Max Wong
- 694
- 10
- 18
1
vote
1 answer
How to call function/classes in c++ .so files, generated by Bazel, in Python?
Let's say I have a simple class in hello.h
#ifndef LIB_HELLO_GREET_H_
#define LIB_HELLO_GREET_H_
class A{
public:
int a = 0;
int b = 0;
int add(){
return a+b;
}
};
#endif
with bazel build…

checkmark1234321
- 23
- 3
1
vote
1 answer
cppyy.ll.cast fails to cast char*
Let's assume we have a char* named chr_ptr from some external library.
I tried to cast this pointer to char* by using cppyy.ll.cast["char*"](chr_ptr)
Expected: cppyy.LowLevelView
Actual: str
Other datatypes works well, this problem only occurs…

ErdoganO
- 71
- 4
1
vote
1 answer
SIGSEGV on doing "import cppyy"
I have a docker image in which cppyy import has started crashing. I tried comparing outputs of pip freeze and apt list --installed between working and non working docker images, but see no differences.
Still on non working docker, importing cppyy…

Rajat Verma
- 27
- 4
1
vote
2 answers
How to call Python from C++?
From the docs :
cppyy is an automatic, run-time, Python-C++ bindings generator, for
calling C++ from Python and Python from C++.
(Emphasis mine)
I don't see any instructions for doing the same, however, so is it possible to call Python via C++…

Tejas Garhewal
- 43
- 7
1
vote
0 answers
How to convert ndarry to cpp vector array
I'm running cpp code in python using cppyy module.
At some point I need to pass array to the CPP function. When I pass numpy array I get following error.
ValueError Traceback (most recent call…

Aba
- 11
- 1
1
vote
1 answer
How to access help() answers from script
When python is used in interactive mode, cppyy provides excellent information via python's help() function. I would like to access these answers in a non-interactive python script. Is this possible?

Edward C. Jones
- 25
- 2
1
vote
1 answer
cppyy and std::is_same_v (C++17)
If I run the following test script in cppyy v1.6.2 on my Ubuntu 20.04 system:
#!/usr/bin/python3
import cppyy
cppyy.cppdef("""
struct Test {
void test() const {
std::cout << std::is_same::value << std::endl; // works
std::cout <<…

Ralf Ulrich
- 1,575
- 9
- 25
1
vote
1 answer
cppyy template class instantiation has no virtual destructor
I have the following child class set up in my Python code:
class NodeRewriter(SyntaxRewriter[SyntaxNode]):
def visit(self, node: SyntaxNode):
print(node)
Here are the relevant objects:
RuntimeWarning: class…

DLAN
- 581
- 1
- 4
- 10
1
vote
2 answers
How do I get cppyy to find additional headers?
I have a directory structure:
include/foo/bar/header1.h
include/foo/bar/header2.h
header1.h includes header2.h. However, when I attempt this:
import cppyy
cppyy.add_include_path('include')
cppyy.include('foo/bar/header1.h')
I get the…

DLAN
- 581
- 1
- 4
- 10
1
vote
1 answer
How to use cppyy to embed Python instead of boost-python
I am currently using boost-python to embed a Python interpreter into my C++ application and facilitate passing data from the executed Python process to the running C++ application through the boost-python bindings, as per…

Jan Christoph Terasa
- 5,781
- 24
- 34
1
vote
1 answer
How I resolve Cppyy load_library giving Runtime error?
Okay so according to the answer I found here to the question titled "Calling C/C++ from Python?" here, and also on the cppyy documentation website, I made some sample classes in .h and .cpp files and tried to include them in Python. While the .h…

KuuhakuBlank00
- 11
- 2
1
vote
1 answer
Revert cppyy automatic mapping of operator() to __getitem__ via C++ pythonization callback
As is also explained in this cppyy issue, an A& operator() on the C++ side is mapped to the python __getitem__.
On the issue it is suggested to add a special pythonization if this is not the wished for result.
An extra constraint in my case would be…

hassec
- 686
- 4
- 18
1
vote
1 answer
cppyy unable to open shared library
I am trying to load a .so in cppyy, but getting below error.
Is there any way to see what exact error is there, due to which Load() is failing
load_my_lib.py:57: in
…

rajat verma
- 13
- 2
1
vote
2 answers
Error in cmd whlie installing CPPYY on windows
I have been trying to install Cppyy on my computerbut I'm new to this so I don't know a whole lot about this I have python and pip install on my computer
C:\WINDOWS\system32>python --version
Python 3.8.6
C:\WINDOWS\system32> pip --version
pip…

sarfaraz saleem
- 45
- 8