aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-09-28 15:49:53 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:18:18 -0300
commit5c3e73b48f8d9b2fb0f1b5abef10df3736a93f68 (patch)
treeed8b4cbe0e2f84acfc0786ce87db5a06bda5b371 /libshiboken
parent7681b23a5c4fb578ec050f65945bfe87c37c36e5 (diff)
Create Module macro compatible with python 2.x and 3.x.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/sbkmodule.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/libshiboken/sbkmodule.h b/libshiboken/sbkmodule.h
index 784cb201d..f089ad8d4 100644
--- a/libshiboken/sbkmodule.h
+++ b/libshiboken/sbkmodule.h
@@ -26,6 +26,22 @@
#include "sbkpython.h"
#include "shibokenmacros.h"
+#if PY_MAJOR_VERSION >= 3
+ #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
+ #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
+
namespace Shiboken {
namespace Module {