[ruby] should initialize static variables inside %init{}, in which it will not be

excuted concurrently by multiple threads.
This commit is contained in:
Takashi Tamura 2017-02-22 12:25:27 +09:00
commit 04a7c4f8b8
2 changed files with 11 additions and 3 deletions

View file

@ -32,11 +32,19 @@ extern "C" {
#define SWIG_RUBY_INTERNAL_ENCODING "UTF-8"
#endif
static rb_encoding *swig_ruby_wstring_encoding;
static rb_encoding *swig_ruby_internal_encoding;
#ifdef __cplusplus
}
#endif
%}
%init{
swig_ruby_wstring_encoding = rb_enc_find( SWIG_RUBY_WSTRING_ENCODING );
swig_ruby_internal_encoding = rb_enc_find( SWIG_RUBY_INTERNAL_ENCODING );
}
%include <rubywstrings.swg>
%include <typemaps/std_wstring.swg>