Hello there.
I want to emebe Neko in desktop manager I write, for Windows, to use it as a
plugin language.
I don't want to wrapp everything out there in Windows needed for this job,
so Neko must be able to dynamicaly call System API functions,
something that is Lua done using this code:
---------------------------------------------------------------------------------------------------------------------
if not USES( 'lib.dynacall', "try" ) then
print "Skipping DynaCall (module not compiled)"
return
end
local declare= ASSUME( lib.dynacall.declare )
local MessageBox, err= declare( "user32", "MessageBox", "i=IAAI", "stdcall"
)
ASSUME(MessageBox)
local answer = MessageBox( 0, "This is a test of the dynamic function
binding library.\nDo you like it?", "Surprise!", 4 )
if answer==6 then -- YES!
MessageBox( 0, ":-)", "Fine!", 0 )
else -- NO?
ASSUME( answer==7 )
MessageBox( 0, ":-(", "you don't?", 0 )
end
---------------------------------------------------------------------------------------------------------------------
Can I achieve that in Neko ? Moreover, I didn't manage to solve following
problem in Lua, and thats how I found Neko:
Theproblematic scenario is the one with callbacks, like the one in for
instance EnumWindows system API to get all windows. This function
requires C
callback so it can call its clients for every window in the system it founds.
Plugin writters must be able to use such functions from Neko direcltly if
wrapper is not supplied (there are dozen of such functions in Win SDK,
and we can provide wrappers just for most common of them, not for all).
I saw documentation about neko FFI & callbacks but still puzzled about this.
So, is it possible for instance, for Neko programmer, to dynamicaly call
EnumWindows witch has C function pointer as an argument, and supply Neko
function
as a callback instead C function (not directly ofcourse, but any mechanism
will be enough).
Any idea, tip or tip is highly appreciated
Thanx.
PS: EnumWindows docs:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/enumwindows.asp
--
www.r-moth.com
http://r-moth.deviantart.com
--
Neko : One VM to run them all
(http://nekovm.org)