Subject:
[ruby-ffi] Win32 example of basic usage at GitHub?
From:
Jon
Date:
10/6/09 11:46 AM
To:
ruby-ffi


Would you mind if I updated

http://wiki.github.com/ffi/ffi/basic-usage

...with a section below "Hello, World using FFI" with code (and some
blah blah) like the following (assuming this is the correct basic
usage for calling typical Win32 API fcns):

require 'ffi'

module HelloWin32
  extend FFI::Library

  ffi_lib :user32
  ffi_convention :stdcall

  attach_function :message_box, :MessageBoxA,
[ :pointer, :string, :string, :uint ], :int
end

rc = HelloWin32.message_box nil, 'Hello Win32 World!', 'FFI Win32
Example', 1
puts "Return code: #{rc}"


Jon