Minimal Boost Python example not working
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 32/100
調査の方向性
示されている C++20 Boost.Python モジュールを Python 3.10 と my_module.printStr 呼び出しで実行し、その後 def("printStr", printStr) 周辺の境界と std::string 変換を調べてください。問題を再現するために必要なビルドおよびランタイム構成を記録し、呼び出しが segmentation fault なしで BEFORE、メッセージ、AFTER を出力したら完了を確認してください。
索引モデルが issue の本文から書いたものです。
説明
I'm having trouble getting boost python to work with this minimal example. I've emailed the mailing list but have had no response.
I'm using C++20
#include <boost/python.hpp>
#include <iostream>
#include <string>
void printStr(const std::string &testStr) {
std::cout << "BEFORE" <<std::endl;
std::cout << testStr <<std::endl;
std::cout << "AFTER" <<std::endl;
}
BOOST_PYTHON_MODULE(my_module) {
using namespace boost::python;
def("printStr", printStr);
}
This compiles fine, but I get a segmentation fault when I attempt to call the function from python (using 3.10):
import my_module
message = "This is a test"
my_module.printStr(message)
The output I get:
BEFORE
Segmentation fault
Can you tell me what I'm doing wrong? Thanks in advance
- 主要言語
- C++
- スター
- 537
- フォーク
- 223
- 平均マージ
- 11時間 22分
- マージ済み PR(30日)
- 2
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
boostorg/python のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
-
BoostDetectToolset-1.90.0.cmake file not found in an include() call in boost_python-config.cmake オープン
難易度 3/5 1〜2日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
boostorg/python の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
objectionary/eo-graphs#74 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
QuantStack/git2cpp#187 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100