File: mymodule.cpp

package info (click to toggle)
cppimport 22.08.02-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 260 kB
  • sloc: python: 756; cpp: 71; ansic: 31; sh: 8; makefile: 4
file content (20 lines) | stat: -rw-r--r-- 385 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
<%
import pybind11
cfg['compiler_args'] = ['-std=c++11']
cfg['include_dirs'] = [pybind11.get_include(), pybind11.get_include(True)]
%>
*/
#include <pybind11/pybind11.h>

namespace py = pybind11;

int add(int i, int j) {
    return i + j;
}

PYBIND11_PLUGIN(mymodule) {
    pybind11::module m("mymodule", "auto-compiled c++ extension");
    m.def("add", &add);
    return m.ptr();
}