Win32API is deprecated after Ruby 1.9.1

Win32API is deprecated after Ruby 1.9.1

Postby Frankn » Mon Mar 22, 2021 5:18 pm

I'm getting this error
C:/Program Files/SketchUp/SketchUp 2021/Tools/extensions.rb:197: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead

My plugin was working before today and I haven't changed anything, what can be causing this error all of a sudden?



Re: Win32API is deprecated after Ruby 1.9.1

Postby Dan Rathbun » Fri Apr 23, 2021 6:10 pm

This is not an error. It is a warning.

Prior to Ruby 2.x, Win32API was a compiled .so file.

Then they (the Ruby Core project) deprecated it and began (with Ruby 2.0 in SketchUp 2014 thru 2016) distributing Ruby with a "Win32API.rb" wrapper file that defined wrapper calls using the DL standard library.

But later on (by Ruby 2.2.4 with SketchUp 2017 and higher,) even the DL standard library was deprecated, and the "Win32API.rb" wrapper file was rewritten to change the DL library calls into Fiddle library calls.

So even now with Ruby on the latest SketchUp, we would still expect old Win32API method calls to be translated correctly into Fiddle library calls.

The warning cannot be suppressed as it is stated at the top of the "Win32API.rb" wrapper file without condition. You will see it output to the console by the first extension that calls a require "Win32API".

Okay, but there is always a chance things could have been broken as changes to the Fiddle library might change with Ruby version changes.

The latest SketchUp 2021 is now up to Ruby version 2.7.1. SketchUp 2020 was using Ruby version 2.5.5.

Did you see differences between loading under these 2 Ruby versions ?

I would suggest using a Ruby Console opener like Eneroth's to see what other errors are output to the console. It is best when troubleshooting to switch off the extension so it does not load at startup, and then manually load it with the console open to see any other errors.
    I'm not here much anymore. But a PM will fire email notifications.
    User avatar
    Dan Rathbun 
    PluginStore Author
    PluginStore Author

    Re: Win32API is deprecated after Ruby 1.9.1

    Postby Frankn » Mon May 10, 2021 1:25 am

    Thanks for the info Dan... I didn't check to see if there's a difference when loading different versions, just haven't had time and other than being annoying I don't see any problems in my plugin.

    When I get a chance I'll look into it more and see if there are other errors as you suggested.


    SketchUcation One-Liner Adverts

    by Ad Machine » 5 minutes ago

    Ad Machine 


    Return to Developers' Forum

    Who is online

    Users browsing this forum: tudydulda and 4 guests

    Visit our sponsors: