[ruby] should initialize static variables inside %init{}, in which it will not be
excuted concurrently by multiple threads.
This commit is contained in:
parent
e7eece9bcd
commit
04a7c4f8b8
2 changed files with 11 additions and 3 deletions
|
|
@ -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>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue