How to pass C pointer to SV task using DPI?

In reply to orgjhrim1:

SystemVerilog has no pointers and therefore there’s no way reference a pointer that C understands from SystemVerilog.

However, the DPI will convert an SystemVerilog function/task argument to a pointer in C that you can access depending on the argument direction. However, each language domain is responsible it own memory allocation, so you can’t pass a variable sized data structure from C to SV without allocating the space to hold it on the SystemVerilog side first. For smaller data structures you could define a fixed sized array, copy the needed data and also pass the size of the data as another argument.