#133 Silence Ruby's $swig_runtime_data_type_pointer2 warning

closed-accepted
cfis
None
5
2005-12-08
2005-11-08
Evan Wies
No

When run in verbose mode (either by setting
$VERBOSE=true or by running ruby with the -w flag), a
SWIG library emits the following warning when required:

mylibrary.so: warning: global variable
`$swig_runtime_data_type_pointer2' not initialized

The action that generates this warning is intentional.
The fact that the variable is not initialized tells
the SWIG module that it needs to initialize itself.

Silencing this warning can be achieved by temporarily
changing the $VERBOSE global in SWIG_Ruby_GetModule.

The following patch is from SWIG 1.3.27, applied to
rubydef.swg:

diff . /rubydef.swg
/usr/local/share/swig/1.3.27/ruby/rubydef.swg
245c245
< VALUE pointer;
---
> VALUE pointer, verbose;
247a248,251
> /* temporarily disable warnings, since the
pointer check causes warnings with 'ruby -w' */
> verbose = rb_gv_get("VERBOSE");
> rb_gv_set("VERBOSE", Qfalse);
>
252a257,260
>
> /* reinstate warnings */
> rb_gv_set("VERBOSE", verbose);
>

Discussion

  • William Fulton

    William Fulton - 2005-11-09
    • assigned_to: nobody --> cfis
     
  • Marcelo Matus

    Marcelo Matus - 2005-12-08
    • status: open --> closed-accepted
     
  • Marcelo Matus

    Marcelo Matus - 2005-12-08

    Logged In: YES
    user_id=246059

    thanks,

    marcelo

     

Log in to post a comment.