On Wed, Jun 07, 2017 at 06:24:22PM +0000, ade90036 via Digitalmars-d-learn wrote: > On Monday, 5 June 2017 at 16:30:53 UTC, Era Scarecrow wrote: > > On Monday, 5 June 2017 at 16:04:28 UTC, ade90036 wrote: > > > > > Unfortunately the struct doesn't know at compile time what the > > > size of the constant_pool array, or at-least was not able to > > > specify it dynamically. > > > > It also won't know ahead of time how many fields, methods or > > attributes you have either. > > > > First I'd say all the arrays will have to be redefined to use [], > > rather than a fixed size. > > > > Glancing at the chapter information, you're probably not going to > > have an easy time, and will have to simply have to fill in the > > fields individually in order followed by allocating the arrays and > > probably filling/loading those immediately (although it's possible > > the array contents are done at the end, though it seems doubtful). > > Thanks for the reply. > > I guess i didnt pick such an easy task afterall. > > I shall parse each fields individually. [...]
"Structs" with variable size fields have no direct equivalent in D's type system, so you'll probably have a hard time mapping this directly. What you *could* do, though, is to load the data into a ubyte[] buffer, then create a proxy struct containing arrays where you have variable-sized fields, with the arrays slicing the ubyte[] buffer appropriately. Unfortunately, yes, this means you have to parse the fields individually in order to construct these slices. T -- This is a tpyo.