From f36e7e57ef5e3dd690c996c048fab79f11bc332f Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Mon, 13 May 2024 21:51:42 +0200 Subject: [PATCH] Forward declaration works --- src/utilities/core/CommonImport.i | 11 ----------- src/utilities/core/jsoncpp.i | 9 +++++++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/utilities/core/CommonImport.i b/src/utilities/core/CommonImport.i index b35dae77900..2004bde55b5 100644 --- a/src/utilities/core/CommonImport.i +++ b/src/utilities/core/CommonImport.i @@ -11,17 +11,6 @@ #include #include #include - -#if defined SWIGRUBY - extern "C" { - #ifdef HAVE_RUBY_ENCODING_H - #include "ruby/encoding.h" - #endif - - rb_encoding *rb_utf8_encoding(void); - ID rb_intern3(const char *name, long len, rb_encoding *enc); - } -#endif %} %include diff --git a/src/utilities/core/jsoncpp.i b/src/utilities/core/jsoncpp.i index d5d288e40e9..e5bce4ef2b3 100644 --- a/src/utilities/core/jsoncpp.i +++ b/src/utilities/core/jsoncpp.i @@ -78,6 +78,15 @@ %fragment("JsonToDict","header", fragment="SWIG_FromCharPtrAndSize") { + extern "C" { + struct OnigEncodingTypeST; + typedef struct OnigEncodingTypeST OnigEncodingType; + typedef const OnigEncodingType rb_encoding; + + rb_encoding *rb_utf8_encoding(void); + ID rb_intern3(const char *name, long len, rb_encoding *enc); + } + SWIGINTERN VALUE SWIG_From_JsonValue(const Json::Value& value) { switch(value.type()) {