Do you use same compiler settings (esp. structure fields alignment) in LibRaw compilation and your app compilation.
If structures are aligned differently, you may think you use params.half_size, but really change other structure field.
Try to use default settings (i.e. no raw.imgdata.params.... assignment).
I've tried both your samples without any problem (using dcraw_emu LibRaw sample with -mem switch to use open_buffer() interface)
Do you use same compiler settings (esp. structure fields alignment) in LibRaw compilation and your app compilation.
If structures are aligned differently, you may think you use params.half_size, but really change other structure field.
Try to use default settings (i.e. no raw.imgdata.params.... assignment).
I've tried both your samples without any problem (using dcraw_emu LibRaw sample with -mem switch to use open_buffer() interface)