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 (25 lines) | stat: -rw-r--r-- 420 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
21
22
23
24
25
/*
<%
setup_pybind11(cfg)
cfg['dependencies'] = ['thing.h']
%>
*/
#include <pybind11/pybind11.h>
#include "thing.h"
#include "thing2.h"

namespace py = pybind11;

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

PYBIND11_MODULE(mymodule, m) {
    m.def("add", &add);
#ifdef THING_DEFINED
    #pragma message "stuff"
    py::class_<Thing>(m, "Thing")
        .def(py::init<>())
        .def("cheer", &Thing::cheer);
#endif
}