I use DPI-C to compile a C code and run with irun.
Assume I wish to pass a testcase directory to my C and Verilog codes. I managed to do it for Verilog but not my C code.
#!/bin/ksh
#TC=$2
TC=TEST_1
irun -64bit -access +rwC -g \
-gui \
other flags \
-DMYTC="TEST_1" \
other flags
IN my C code I would use
sprintf(str_filename, "%s/my_testcase.txt", MYTC);