lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Added union, bitstring type and other minor changes.
I use msvc6.0. Calling DLL functions tested in win2k
sp3, winxp, winxp sp1.

(http://lua-users.org/files/wiki_insecure/users/tnodir/)

Examples:

-- Union
if mem.sizeof(mem.struct{mem.byte, "b"; mem.int, -1,
"i"})
 ~= mem.sizeof(mem.struct{mem.int, "i"}) then
	error"Memory alignment: Union"
end

-- BitString
local bits = assert(mem.new(mem.struct{mem.int, "i",
mem.bitstring, -1, "b"}))
bits.b[7] = 1
if bits.i ~= 128 then error"BitString" end
mem.free(bits)

-- Call function
local beep = assert(mem.new(mem.cfunction{mem.int,
"freq", "duration"}))
beep[0] = assert(loadlib("kernel32.dll", "Beep"))
beep{1000, 100}



		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com