lang:c:pybind11
差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
lang:c:pybind11 [2025/08/24 11:06] – editor | lang:c:pybind11 [2025/09/06 12:45] (現在) – [Windows の場合] editor | ||
---|---|---|---|
行 56: | 行 56: | ||
===== complile ===== | ===== complile ===== | ||
+ | ==== Linux/Mac の場合 ==== | ||
c++ exPybind11.cpp -o examplePybind11.so -std=c++11 -shared -fPIC \ | c++ exPybind11.cpp -o examplePybind11.so -std=c++11 -shared -fPIC \ | ||
-I" | -I" | ||
行 64: | 行 64: | ||
" | " | ||
- | | + | ==== Windows の場合 ==== |
+ | コンパイラや環境に依存すると思われる。\\ | ||
+ | 以下は、" | ||
+ | |||
+ | c++ exPybind11.cpp -o examplePybind11`python-config --extension-suffix` \ | ||
+ | -std=c++11 -shared -fPIC \ | ||
+ | -I" | ||
+ | `python-config --cflags --ldflags` | ||
+ | |||
+ | 上記の -I" | ||
+ | ---- | ||
===== python での使用方法 ===== | ===== python での使用方法 ===== | ||
<file python example.py> | <file python example.py> | ||
行 98: | 行 108: | ||
} | } | ||
} | } | ||
+ | </ | ||
+ | ---- | ||
+ | ===== threading/ | ||
+ | python で threading からの呼び出しでは、独立スレッドにならない。 | ||
+ | 独立スレッドにするために、以下のコードを挿入する。 | ||
+ | <file c++ thread.cpp> | ||
+ | void function(void){ | ||
+ | pybind11:: | ||
+ | // 処理 | ||
+ | pybind11:: | ||
+ | } | ||
</ | </ | ||
+ | |||
+ | |||
+ |
lang/c/pybind11.1756033574.txt.gz · 最終更新: by editor