[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [ann] luamem
- From: Nodir Temirhodzhaev <nvtem@...>
- Date: Wed, 20 Oct 2004 02:22:41 -0700 (PDT)
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