From ed00d8dbd7f52d3d8043e4bec185a06dd8b947a2 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 affa3d50030..d7780e3df35 100644 --- a/src/utilities/core/jsoncpp.i +++ b/src/utilities/core/jsoncpp.i @@ -76,6 +76,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) { if (value.isNull()) {