Skip to content

Commit 319383b

Browse files
Add a function object declarator for adding ordinary C functions to the pythin registry.
1 parent 8ea0a32 commit 319383b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pythonBuffer.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ namespace {
802802
/// a convenience macro for creating a python module with a single global object
803803
/// @param name module name
804804
/// @param object C++ object to expose to python
805-
#define CLASSDESC_PYTHON_MODULE(name) \
805+
#define CLASSDESC_PYTHON_MODULE(name) \
806806
PyMODINIT_FUNC PyInit_##name() \
807807
{ \
808808
static PyModuleDef module_##name = { \
@@ -830,6 +830,10 @@ namespace {
830830
#define CLASSDESC_ADD_GLOBAL(object) \
831831
static int add_global_##object=(classdesc::RESTProcess(classdesc::registry,#object,object), 0);
832832

833+
#define CLASSDESC_ADD_FUNCTION(object) \
834+
static int add_global_##object=(classdesc::RESTProcess(classdesc::registry,#object,&object), 0);
835+
836+
833837
/// Add a type foundry or factory into the registry. \a type is also
834838
/// used as the name this object will be referred to from Python, so
835839
/// must be unqualified at the macro call. The following optional

0 commit comments

Comments
 (0)