@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.
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?