# Warning when running sqlite3 with Ruby on Windows

**URL:** <https://www.ruby-forum.com/t/warning-when-running-sqlite3-with-ruby-on-windows/127612>\
**Category:** Ruby\
**Created:** [January 30, 2008, 9:01pm UTC](https://www.ruby-forum.com/t/warning-when-running-sqlite3-with-ruby-on-windows/127612 "2008-01-30T21:01:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eliben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3bc359/32.png) [@eliben](https://www.ruby-forum.com/u/eliben)\
**Post date:** [January 30, 2008, 9:01pm UTC](https://www.ruby-forum.com/t/warning-when-running-sqlite3-with-ruby-on-windows/127612/1 "2008-01-30T21:01:13Z")

</div>

Hello,

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

---

<div class="post-metadata">

**Author:** ![eliben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3bc359/32.png) [@eliben](https://www.ruby-forum.com/u/eliben)\
**Post date:** [January 31, 2008, 12:25am UTC](https://www.ruby-forum.com/t/warning-when-running-sqlite3-with-ruby-on-windows/127612/2 "2008-01-31T00:25:31Z")

</div>

On Jan 30, 5:59 pm, Eli B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Creates the following warning:  
> Eli
> 
> P.S. Ruby 1.8.6 from the one click installer for Windows

Can you be more specific?

the gem is sqlite3-ruby:  
sqlite3-ruby (1.2.1)

The latest One-Click Installer version:  
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

RubyGems version installed:  
0.9.4

(Also tested on 1.0.1)

Output from IRB:

irb(main):001:0\> require ‘rubygems’  
=\> true  
irb(main):002:0\> require ‘sqlite3’  
=\> true  
irb(main):003:0\> db = SQLite3::Database.new(“test.db3”)  
=\> #\<SQLite3::Database:0x516f198 …\>

Now, using ruby command line:

D:\Users\Luis\Desktop\>ruby test-sqlite3.rb

No output for your script

and with -v (Verbose mode):  
D:\Users\Luis\Desktop\>ruby -v test-sqlite3.rb  
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]  
C:/Ruby/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.1-x86-mswin32/lib/  
sqlite3\_api.so: warning: global variable `  
$swig\_runtime\_data\_type\_pointer2’ not initialized

Conclusion:  
The warning you’re getting is because:  
You used -v command line option to run your script or  
You tweaked $VERBOSE and set it to true

HTH,

---

<div class="post-metadata">

**Author:** ![eliben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3bc359/32.png) [@eliben](https://www.ruby-forum.com/u/eliben)\
**Post date:** [January 31, 2008, 3:01pm UTC](https://www.ruby-forum.com/t/warning-when-running-sqlite3-with-ruby-on-windows/127612/3 "2008-01-31T15:01:01Z")

</div>

> You tweaked $VERBOSE and set it to true

Luis,

Thank you - this actually explains the problem. However, I am not  
running with -v, but rather with -w.

This script:

require ‘sqlite3’  
puts $VERBOSE  
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?

Thanks in advance,  
Eli

---

<div class="post-metadata">

**Author:** ![eliben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/3bc359/32.png) [@eliben](https://www.ruby-forum.com/u/eliben)\
**Post date:** [January 31, 2008, 11:37pm UTC](https://www.ruby-forum.com/t/warning-when-running-sqlite3-with-ruby-on-windows/127612/4 "2008-01-31T23:37:47Z")

</div>

On Jan 31, 11:56 am, Eli B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 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,
