sketchucation logo sketchucation
    • Login
    1. Home
    2. dburdick
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.8b introduces important bugfixes for Fredo's Extensions Update
    D
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 7
    • Posts 81
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: [Bug]Win32api.so and Sketchup7

      @cphillips said:

      @daiku said:

      Chris:

      My plugins use Win32api.so, and so far I haven't seen any problems with SU7. But I upgraded from SU6, so that may be why. Tell us more about RubyDL - this is the first I've heard of it. CB.

      Its part of the standard Ruby install and I just copied the files over. It is meant to do the same job as win32api.so except it has a much nicer interface.

      Here is code to call the getKeyState function in user32.dll using win32api.so

      require 'Win32API' 
      > $win32GetKeyStateFunc=Win32API.new("user32.dll", "GetKeyState", ['N'], 'N')
      > $win32GetKeyStateFunc.call(0)
      > 
      

      And the same thing with RubyDL.

      
      > 
      > require "dl"
      > require "dl/import"
      > module KeyInput
      >     extend DL;;Importable
      >     dlload("user32.dll")
      >     extern "int getKeyState(short)"
      > end
      > KeyInput.getKeyState(0)
      

      The first good thing is the declaration of the function is more C like than the winapi method of passing the parameter types in a array. And you can call the function without the .Call().

      RubyDL also allows structures to be passed back and forth where win32api does not.

      http://www.jbrowse.com/text/rdl_en.html

      Chris

      Hi Chris,

      I tried your DL example in SU7.1 and it didn't work for some reason. The DL files are all installed correctly in the SU plugins folder. Here's the error:

      load 'DLTest.rb'
      Error: #<RuntimeError: C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/dl/import.rb:126:in symbol': can't find the symbol getKeyState'>
      C:/Program Files (x86)/Google/Google SketchUp 7/Plugins/dl/import.rb:126

      Any idea why it's bombing on this?

      posted in Developers' Forum
      D
      dburdick
    • 1
    • 2
    • 3
    • 4
    • 5
    • 5 / 5