view ruby/rbdc/examples/win32msgbox.rb @ 46:c21d1c2c84e1

- removed pydc.py wrapper overhead (which only called pydcext.so functions, directly, anyways) * implies renaming pydcext.* to pydc.* * while at it, iterate directly over args that are passed in (before we did extract fptr, sig and a tuple for the args and iterated over latter afterwards); we might have a tiny perf improvement now - added type stub as package_data
author Tassilo Philipp
date Fri, 13 Nov 2020 14:10:31 +0100
parents 5e159be89d73
children
line wrap: on
line source

#//////////////////////////////////////////////////////////////////////
#
#	win32msgbox.rb
#	Copyright 2007-2015 Tassilo Philipp
#
#	Dyncall sample loading user32.dll on windows, listing all user32
#   symbols and displaying a #	native windows message box by calling
#   MessageBoxA(...).
#
#///////////////////////////////////////////////////////////////////////

require 'rbdc'

l = Dyncall::ExtLib.new
if l.load('user32') != nil and l.syms_init('user32')
	l.syms_each { |s| puts s }
	puts l.syms_count
	puts l.exists?(:NonExistant)
	puts l.exists?(:MessageBoxA)
	puts l.call(:MessageBoxA, 'IZZI)i', 0, 'Hello world from dyncall!', 'dyncall demo', 0)
	# @@@ check puts on dyncall called function returning a void... crashes e.g. change above signature to IZZI)v
end