Passing multi dimensional dynamic array to C via DPI

Hi,

I have the following data type on the SV side



int           psram_rec_out_even[][][];
psram_rec_out_even = new[30];

 foreach( psram_rec_out_even[i] )
         begin
           psram_rec_out_even[i] = new[10];
           foreach( psram_rec_out_even[i][j] )
             begin
             psram_rec_out_even[i][j] = new[60];
             end 
         end
get_DPI_PSRAM_rec_out_even(psram_rec_out_even);

DPI Function:


void get_DPI_PSRAM_rec_out_even(const svOpenArrayHandle h) {
  int*** b;int* a;
  b = dec.get_DPI_PSRAM_rec_out_even();
  for(int i = svLow(h,1); i<= svHigh(h,1); i++) {
    for(int j = svLow(h,2); j<= svHigh(h,2); j++) {
      for(int k = svLow(h,3); k<= svHigh(h,3); k++) {
        a = (int*)svGetArrElemPtr3(h,i,j,k);
        *a = b[i][j][k];
      }
    }
  }
};

When I run this I get the following error message:
dpi openarray formal and actual do not have supported actual types.
get_DPI_PSRAM_rec_out_even(psram_rec_out_even)

Does the array on the SV side have to be statically allocated?

Thanks,
-ND

In reply to nndad:

Anytime you get a message like “not supported” means what you are doing is valid, but unimplemented in your tool. You might try casting your 3-D array into 1-D array, then passing that along with the original dimensions through into your DPI routine.