MCPcopy Create free account
hub / github.com/TNG/boost-python-examples / main

Function main

10-Embedding/embedding.cpp:17–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15
16
17int main(int argc, char** argv)
18{
19 try {
20 PyImport_AppendInittab((char*)"mymodule", INIT_MODULE);
21 Py_Initialize();
22 object main_module = import("__main__");
23 dict main_namespace = extract<dict>(main_module.attr("__dict__"));
24 object mymodule = import("mymodule");
25
26 main_namespace["precreated_object"] = Base("created on C++ side");
27 exec_file("embedding.py", main_namespace, main_namespace);
28 } catch (error_already_set& e) {
29 PyErr_PrintEx(0);
30 return 1;
31 }
32 return 0;
33}

Callers

nothing calls this directly

Calls 1

BaseClass · 0.70

Tested by

no test coverage detected