lua-users home
lua-l archive

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


Jerome Vuarand wrote:
Without a dump of the actual data, the problem can come from either
struct of FB. Try:

a = struct.pack("BHIL",1,2,3,4)
print(table.concat({string.byte(a,1,#a)}," "))

On my 32bits WinXP it gives:

1 2 0 3 0 0 0 4 0 0 0

which is the expected result.

This test on my system gave incorrect result: 1 2 0 3 4 0 0 0
which explains why the DLL I sent to Merick didn't work for him
(though it passed teststruct.lua OK).

The source for the DLL was taken from:
http://www.inf.puc-rio.br/~roberto/struct/

The problem appears on the line 83 of struct.c,
here's the patch:
-   case 'i': return getnum(fmt, sizeof(int));
+   case 'i': case 'I': return getnum(fmt, sizeof(int));

--
Shmuel