Dynamic array from C to UVM

Hi,

I have a function in C which returns a dynamic array.
import “DPI-C” function void get_code(output bit [7:0] out);

In C this is how I defined.

 void get_hdcp22_cipher_code(svOpenArrayHandle out);
  uint8_t* data_out;
  data_out = (uint8_t* ) svGetArrayPtr(out);
  for (i = 0; i < 16; ++i)
  {
        *((uint8_t* ) svGetArrayPtr(data_out) + 8) = 22;
  }

I am always getting 00 from the C.

can someone please help

Note: I am sending constant data just for experiment purpose.
Regards
Phani