in reply to Re: C types and SV's
in thread C types and SV's and unpack
The problem here is that, in the general case (which the OP may not care about, I'll admit) using plain ol' pack/unpack isn't very portable, as you have to tell it how the structure is laid out in memory. And C makes very few guarantees about that. Merely by looking at the data you can't tell, for example, whether you have a 16-, 32- or 64-bit value; you can't tell whether a word is signed or unsigned; you can't tell whether a structure has been padded with empty space so that its members are on word boundaries; and so on.
I'd take a look at Convert::Binary::C, and in particular the ccconfig script that comes with it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: C types and SV's
by Corion (Patriarch) on Jul 19, 2010 at 09:53 UTC | |
by DrHyde (Prior) on Jul 19, 2010 at 10:47 UTC | |
by blakew (Monk) on Jul 19, 2010 at 20:14 UTC | |
by DrHyde (Prior) on Jul 20, 2010 at 10:03 UTC |