You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2018/07/04 15:58:09 UTC
[37/41] qpid-proton git commit: PROTON-1868: Fix pn_handle_t python
binding on Visual Studio 64 bit compiles
PROTON-1868: Fix pn_handle_t python binding on Visual Studio 64 bit compiles
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/798894f6
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/798894f6
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/798894f6
Branch: refs/heads/go1
Commit: 798894f63dba6a0d4eaa6e015d6f5ac64274be2f
Parents: ccb9e5a
Author: Andrew Stitcher <as...@apache.org>
Authored: Mon Jun 25 23:01:58 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Tue Jun 26 01:25:03 2018 -0400
----------------------------------------------------------------------
c/include/proton/cproton.i | 7 +++++--
python/CMakeLists.txt | 2 +-
python/cproton.i | 8 ++++++++
ruby/CMakeLists.txt | 2 ++
ruby/cproton.i | 3 +++
5 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/c/include/proton/cproton.i
----------------------------------------------------------------------
diff --git a/c/include/proton/cproton.i b/c/include/proton/cproton.i
index 464e74b..31e5b77 100644
--- a/c/include/proton/cproton.i
+++ b/c/include/proton/cproton.i
@@ -26,7 +26,11 @@ typedef unsigned long int uint32_t;
typedef long int int32_t;
typedef unsigned long long int uint64_t;
typedef long long int int64_t;
+#if UINTPTR_SIZE==8
+typedef unsigned long long int uintptr_t;
+#else
typedef unsigned long int uintptr_t;
+#endif
/* Parse these interface header files to generate APIs for script languages */
@@ -61,8 +65,7 @@ typedef unsigned long int uintptr_t;
%immutable PN_OBJECT;
%immutable PN_VOID;
%immutable PN_WEAKREF;
-/* Treat pn_handle_t like uintptr_t - syntactically it is a C void* but really it's just an int */
-%apply uintptr_t { pn_handle_t };
+
%include "proton/object.h"
%ignore pn_error_format;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/python/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index 2c3f4d9..037552e 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -20,7 +20,7 @@
# NB For python the SWIG module name must have the same name as the input .i file for CMake to generate the
# correct dependencies
-set(CMAKE_SWIG_FLAGS "-threads")
+set(CMAKE_SWIG_FLAGS "-threads" "-DUINTPTR_SIZE=${CMAKE_SIZEOF_VOID_P}")
include_directories (${PN_C_INCLUDE_DIR} ${PYTHON_INCLUDE_PATH})
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/python/cproton.i
----------------------------------------------------------------------
diff --git a/python/cproton.i b/python/cproton.i
index b173dd8..3bc60ea 100644
--- a/python/cproton.i
+++ b/python/cproton.i
@@ -100,6 +100,14 @@ PN_HANDLE(PNI_PYTRACER);
%ignore pn_message_get_correlation_id;
%ignore pn_message_set_correlation_id;
+%typemap(in) pn_handle_t {
+ $1 = PyLong_AsVoidPtr($input);
+}
+
+%typemap(out) pn_handle_t {
+ $result = PyLong_FromVoidPtr((void*)$1);
+}
+
%typemap(in) pn_bytes_t {
if ($input == Py_None) {
$1.start = NULL;
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/ruby/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/ruby/CMakeLists.txt b/ruby/CMakeLists.txt
index 1dc106c..a27a67a 100644
--- a/ruby/CMakeLists.txt
+++ b/ruby/CMakeLists.txt
@@ -28,6 +28,8 @@ list(APPEND SWIG_MODULE_cproton-ruby_EXTRA_DEPS
${PROTON_HEADERS}
)
+set(CMAKE_SWIG_FLAGS "-DUINTPTR_SIZE=${CMAKE_SIZEOF_VOID_P}")
+
include_directories(${PN_C_INCLUDE_DIR} ${RUBY_INCLUDE_PATH})
swig_add_library(cproton-ruby LANGUAGE ruby SOURCES cproton.i)
http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/798894f6/ruby/cproton.i
----------------------------------------------------------------------
diff --git a/ruby/cproton.i b/ruby/cproton.i
index a9c731a..1de88f0 100644
--- a/ruby/cproton.i
+++ b/ruby/cproton.i
@@ -52,6 +52,9 @@ Keep preprocessor directives and macro expansions in the normal header section.
#endif
%}
+/* Treat pn_handle_t like uintptr_t - syntactically it is a C void* but really it's just an int */
+%apply uintptr_t { pn_handle_t };
+
%typemap(in) pn_bytes_t {
if ($input == Qnil) {
$1.start = NULL;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org