aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-09-23 14:32:01 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:16 -0300
commit701466409c3c13ae4573bf73957f6a874ce5ccbf (patch)
treecc7ea48555863e12eaa30c04e0e6cbc9547c0adf /libshiboken
parentd27ed2fea367d787aa7319531d1df1bbd6739e71 (diff)
Create SHIBOKEN MODULE INIT macro.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/sbkpython.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/libshiboken/sbkpython.h b/libshiboken/sbkpython.h
index 4c9ab5c76..24b70fe6d 100644
--- a/libshiboken/sbkpython.h
+++ b/libshiboken/sbkpython.h
@@ -43,6 +43,15 @@
#define SBK_PyString_FromCString PyUnicode_FromString
#define SBK_PyString_FromFormat PyUnicode_FromFormat
#define SBK_PyString_CompareWithASCIIString PyUnicode_CompareWithASCIIString
+
+ // Module MACROS
+ #define SBK_MODULE_INIT_ERROR 0
+ #define SBK_MODULE_INIT_FUNCTION_BEGIN(ModuleName) \
+ extern "C" SBK_EXPORT_MODULE PyObject* PyInit_##ModuleName() {
+
+ #define SBK_MODULE_INIT_FUNCTION_END \
+ return module; }
+
#else
// Note: if there wasn't for the old-style classes, only a PyNumber_Check would suffice.
#define SbkNumber_Check(X) \
@@ -53,6 +62,15 @@
#define SBK_PyString_FromCString PyBytes_FromString
#define SBK_PyString_FromFormat PyString_FromFormat
#define SBK_PyString_CompareWithASCIIString(X, Y) strcmp(PyString_AS_STRING(X), Y)
+
+ // Module MACROS
+ #define SBK_MODULE_INIT_ERROR
+ #define SBK_MODULE_INIT_FUNCTION_BEGIN(ModuleName) \
+ extern "C" SBK_EXPORT_MODULE void init##ModuleName()
+
+ #define SBK_MODULE_INIT_FUNCTION_END \
+ }
+
#endif
#endif