Path to this page:
./
wip/py-cppimport,
Import C++ files directly from Python
Branch: CURRENT,
Version: 20.8.4.2,
Package name: py312-cppimport-20.8.4.2,
Maintainer: kamelderouicheTODO: Adjust the following lines from README.md
##### If you've used cppimport version 0.0.\*, some new features for you! Compiler arguments, multiple source files, bug fixes! Read on.
# Import C or C++ files directly from Python!
Let's try it out. First, if you're on Linux or OS X, install with the terminal command `pip install cppimport`.
Most cppimport users combine it with [pybind11](https://github.com/pybind/pybind11), but you can use a range of methods to create your Python extensions. Raw C extensions, Boost.Python, SWIG all work. Let's look at a simple C++ extension:
```c++
#include <pybind11/pybind11.h>
namespace py = pybind11;
int square(int x) {
return x * x;
}
PYBIND11_MODULE(somecode, m) {
m.def("square", &square);
}
...
Master sites:
RMD160: ac51cd3e672681d1700105019e75fa51341aa473
Filesize: 4173.2 KB
Version history: (Expand)
- (2024-09-19) Package has been reborn
- (2024-09-19) Updated to version: py312-cppimport-20.8.4.2
- (2024-09-15) Package deleted from pkgsrc
- (2023-02-13) Updated to version: py310-cppimport-20.8.4.2
- (2023-02-13) Package has been reborn
- (2021-10-08) Updated to version: py39-cppimport-20.8.4.2