search for: invokeint

Displaying 2 results from an estimated 2 matches for "invokeint".

Did you mean: invokeinst
2008 Jan 26
0
JRuby version of win32-api - initial try
...pe = prototype @return_type = return_type @dll_name = dll if dll == ''kernel32'' @dll = KERNEL32 else @dll = com.sun.jna.NativeLibrary.getInstance(@dll_name) end @library = LoadLibrary.invokeInt([@dll_name].to_java) if @library.nil? || @library == 0 raise Error, "LoadLibrary() function failed for ''#{@dll_name}''" end @func = GetProcAddress.invokeInt([@library, @function_name].to_java) if $KCODE == ''...
2008 Jan 24
0
JRuby, JNA, Windows
...Kernel32 = com.sun.jna.NativeLibrary.getInstance("kernel32") # GetProcAddress() GetCurrentDirectoryA = Kernel32.getFunction(''GetCurrentDirectoryA'') # You can also do -> buf = java.nio.ByteBuffer.allocate(256) buf = Array.new(256).to_java(:byte) GetCurrentDirectoryA.invokeInt([256, buf].to_java) buf = java.lang.String.new(buf) p buf.to_s.strip It''s a little clunkier than MRI at the moment, because Java strings are immutable. We''re passing by reference, so we have to pass a ByteBuffer instead, and convert back and forth. Charles tells me that this wi...