I installed ruby-sqlite3 as a gem from Rubyforge to my Windows PC.
I’ve also downloaded the sqlite3 DLL and placed it in the same
directory with my script, for testing. This simple code:
require ‘sqlite3’
db = SQLite3::Database.new( “test.db” )
Creates the following warning:
c:/ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1-mswin32/lib/
sqlite3_api.so: warning: global variable `
$swig_runtime_data_type_pointer2’ not initialized
However, SQLite3 seems to be working correctly. The DB file is
created, queries work, etc.
Any ideas on how to get rid of that pesky warning ?
Thanks in advance,
Eli
P.S. Ruby 1.8.6 from the one click installer for Windows
You tweaked $VERBOSE and set it to true
db = SQLite3::Database.new( “test.db” )
When run simply as “ruby test.rb” prints “false”. When run as “ruby -w
test.rb” prints “true” and the aforementioned warning.
So, the next question is - doesn’t everyone run ruby with -w ? If the
answer is positive, can I get rid of that warning anyway?
Enabling warnings is a good practice doing testing. In that way you
avoid introduce code that could break (due deprecations between
versions of the language) or because changes introduced can lead to
bugs hard to track.
In this case it seems the SWIG’ed SQLite3 code check or try to access
a undefined global variable.
You can google about that variable name and also dig into the sqlite3-
ruby C extension code to find the root of the problem and provide a
patch.
I haven’t seen a good use of -w or -v outside the context I described.
Hope this shed some light
Regards,
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.