From 270babaf3fefe55d0622df30fe42fabfc87a0411 Mon Sep 17 00:00:00 2001 From: abn Date: Mon, 23 Oct 2023 16:38:34 +0200 Subject: [PATCH] New method: getHiddenCppPointerAsLongLong() + useful for mixed wrapping tools, for example mixing MEDCoupling's SWIG and PyBind11/Nanobind --- src/MEDCoupling_Swig/MEDCouplingCommon.i | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index 448d3e769..1fca14d4b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -680,6 +680,14 @@ namespace MEDCoupling std::ostringstream oss; oss << "C++ Pointer address is : " << self; return oss.str(); } + + // Hack to allow retrieving of underlying C++ pointer whatever the situation + // This allows for example to mix different types of Python binding (SWIG and PyBind for example) + long long getHiddenCppPointerAsLongLong() const + { + return (long long) self; + } + } %extend MEDCouplingGaussLocalization -- 2.30.2