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.



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

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

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

Do you Yahoo!?
Declare Yourself - Register online to vote today!