I'm having trouble creating a .dll file by using the gcc command on windows (MinGW). Here is the command I'm running:
command: gcc -shared -Bsymbolic -o mytest.dll mytest.cpp error:: c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\aashoka\AppData\Local\Temp\cc2UzHHe.o:mytest.cpp.text+0x3a): undefined reference to `Write' collect2.exe: error: ld returned 1 exit status
The .h file --- created using the command: vlog -sv ./mytb.sv -dpiheader ../src_cpp/experiment1.h -- is included in the mytest.cpp. And this file contains the Read and Write functions that is implemented in the mytb.sv. I also have the following lines in mytb.sv
If you are using a version of Questa/Modelsim within the last 8 years, you can put the C/C++ file on the vlog command line and skip the separate gcc step.
Huge code base. I don't think it makes to create a new work flow. It'd be nice to keep HW and software different. ModelSim User's Manual talks about using vlog to compile (default autocompile flow), and external compilation flow (gcc -> object file -> and link that file in modelsim). It looks like I'm following all the instructions. Can't seem to understand why things aren't working.....
Doesn't work. I still get an error when I try to create the .dll file
These are the commands I tried:
[1] g++ -c -IC:\intelFPGA\17.0\modelsim_ase\include -o ./mytest.o ./mytest.cpp comments: I was able to execute this command without any issues
[2] g++ -shared -Bsymbolic -o ./mytest.dll ./mytest.o -LC:\intelFPGA\17.0\modelsim_ase\win32aloem comments: I wasn't able to get past this step
error message: c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: ./mytest.o:mytest.cpp.text+0x2d): undefined reference to '`PrintHelloWorld'
collect2.exe:error:ld returned 1 exit status
PrintHelloWorld() is part of the SystemVerilog Testbench. GCC only knows about PrintHelloWorld() through the experiment3.h header file (the one generated by ModelSim)
The common point of all failing tests is that the functions exported from SV are not visible in the C name space. I'm not familiar with the DPI stuff, the examples I see at the web are looking slightly different, e.g. marking the SV symbols imported to C as extern. Seriously I don't even understand which file imports the SV originated symbols to the linker.
The common point of all failing tests is that the functions exported from SV are not visible in the C name space. I'm not familiar with the DPI stuff, the examples I see at the web are looking slightly different, e.g. marking the SV symbols imported to C as extern. Seriously I don't even understand which file imports the SV originated symbols to the linker.
You are right. The functions exported from SV is not visible to the C namespace. The experiment3.h header file does have the extern keyword. Can you elaborate on "Seriously I don't even understand which file imports the SV originated symbols to the linker" ?