On 12/27/19 4:32 PM, George Dunlap wrote: > The current fromC array code will do the "magic" casting and > martialling even when num_foo variable is 0. Go crashes when doing > the cast. > > Furthermore, the current toC array code will convert a nil slice into > a zero-length malloc. The resulting pointer is non-NULL, and confuses > libxl. > > Only do array marshalling if the number of elements is non-zero; > otherwise, leave the target pointer empty (nil for Go slices, NULL for > C arrays). > > The toC half of this should be folded into "golang/xenlight: > implement array Go to C marshaling". > > Signed-off-by: George Dunlap The .go program I used to test this series is attached, to give you an idea what the current iteration looks like, and potentially give it a spin. -George