Unable to use MINGW's G++ to compile C++ code with DPI-C Export.

Hi,

Newbie here. I have a file named dpi_server.cpp and a systemverilog file named sv_testbench.sv.
Inside the sv_testbench.sv, I have a function named and described as below:

export "DPI-C" function sv_display_message;

function void sv_display_message(input string msg);
     $display("[SV:] At [%0t]: %s", $time, msg);
endfunction

and it is exported to dpi_server.cpp with necessary adjustment being made

#include "svdpi.h"

extern “C” void sv_display_message(const char* msg);

However, when I try to compile them in Questasim 10.6c terminal, with

g++ -shared -Bsymbolic -o dpi_server.dll dpi_server.cpp -L<installed_directory>\win64 -lmtipli -lws2_32 -static-libgcc -static-libstdc++

It will show me a compilation error stated that sv_display_message is unknown.

Hence, I would like to ask if there is any vlog and/or qverilog command which I can use to compile both cpp and sv file while also generating a usable .dll file.

This Siemens sponsored forum is not for tool related issues. Please refer to your tool documentation or contact your vendor support team for additional assistance.