1,349 questions
0
votes
0
answers
50
views
How is the rvalue_from_python_stage1_data convertible pointer is deallocated in boost python
Question
Can you provide some insight what is the role of the rvalue_from_python_stage1_data convertible pointer and how is being deallocated (memory managed) in boost python?
Background
According to ...
2
votes
1
answer
54
views
boost::python pointer to Base class extraction fail
I created a program that exposes class with virtual function to python using boost::python. Also I configured everything so that I could load python module that was created by boost::python and ...
2
votes
0
answers
44
views
boost::python - Export Custom Exception (2nd edition)
Based on Boost 1.88.0, boost::python Export Custom Exception and linked discussions I'm using the following to expose a custom C++ std::exception to python.
class cException : public std::exception
{
...
0
votes
1
answer
87
views
How to avoid defining a wrapper for abstract base class if I only expose derived classes to python but still use the base class non virtual methods?
Given this class
class ABC {
const std::string& getid() const;
/// other pure virtual methods
};
class D1 : public ABC {
/// override and implement virtual methods
};
class D2 : public ...
0
votes
0
answers
51
views
boost:python expose const std::string& [duplicate]
I understand std::string is exposed to python by implicit converters that don't need to be registered.
However, const std::string& isn't
I have
class Cal {
const std::string& get_name() ...
0
votes
0
answers
82
views
Allocating Mutex in a Python Module Developed with C++
I want to create a C++ library that will support both C++-based and Python-based applications running on Windows 10. The C++ application is multi-threaded, so I protect critical sections in my library ...
0
votes
0
answers
56
views
How to make boost::python use the Python embeddable package
I'm currently working on a 32-bit C++ DLL in Visual Studio 2022 which uses boost::python to embed Python code. For my builds I use the include and lib directories from a full installation of 32-bit ...
1
vote
1
answer
101
views
How do I initialize python when running a program as a service in Windows?
I am creating a service based on SFL (Service Framework Library). When I work from the console, it is okay, but when I run it as a service, via "sc start MyService", it issues fatal errors ...
0
votes
0
answers
85
views
Using the Boost library to include a C++ program in python with Python.h, bjam not found
I have code in C++ that performs multiple mathematical equations. When doing it with Python, it takes a long time (about 5 minutes), and when running it in C++, it takes about 10 seconds. I want to ...
0
votes
0
answers
47
views
CMake target_link_libraries for boost-python is the variable ${PYTHON_LIBRARIES} needed?
I am following Advanced C++ / Python integration with Boost.Python tutorial to get a get a grasp on Boost-Python lib.
In the example above I have:
hello.cpp :
#include <boost/python.hpp>
#...
1
vote
1
answer
71
views
Use Boost python with libtorch
I am trying to create a python package from C++ code with Boost python. However when including libtorchin the code, the resulting python package shows strange errors such as
Boost.Python....
1
vote
0
answers
43
views
Pass std::map to python as a parameter [duplicate]
I have the following C++ code:
const std::string Get(const std::map<std::string, std::string> map) {
PyObject* module = PyImport_ImportModule("dummy");
boost::python::dict ...
1
vote
1
answer
68
views
Beast Socket from Boost Python Package Kills Jupyter Kernel
For some reason when exposing the below to python using Boost Python, the unique pointer constructor (the obj constructor) fails. This used to work for me before, not sure why it stopped.
#pragma once
...
0
votes
0
answers
81
views
Visual Studio 2022 not creating DLL using Boost.Python
After following this page on how to install boost in Visual Studio 2022, I added the hello world for Boost.Python into the main.cpp file. However, even though the program builds and runs successfully, ...
0
votes
0
answers
48
views
Is it safe to define static python object in C++ for Boost.Python?
I have a python script that calls some C++ code, and in the C++ part, I want to define some static python object, for example: static boost::python::list obj. However, according to pybind11 issue 1598 ...