File: example.cpp

package info (click to toggle)
pybind11 2.2.4-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,288 kB
  • sloc: cpp: 11,998; python: 5,719; ansic: 2,160; makefile: 191; sh: 44
file content (19 lines) | stat: -rw-r--r-- 386 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
// Basic example from the upstream documentation.
//
// See: http://pybind11.readthedocs.io/en/latest/basics.html

#include <pybind11/pybind11.h>

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

namespace py = pybind11;

PYBIND11_PLUGIN(example) {
    py::module m("example", "pybind11 example plugin");

    m.def("add", &add, "A function which adds two numbers");

    return m.ptr();
}