I am currently exploring Vivado and SystemVerilog, and I’m working on a simple prototype to better understand SystemVerilog DPI and endpoint concepts in windows.
In my prototype, I have followed a Vivado DPI import example as a reference [https://docs.amd.com/r/2021.2-English/ug900-vivado-logic-simulation/Compiling-C-Code]. The prototype involves starting a Python TCP server externally. Then, when executing the Vivado simulator, SystemVerilog is expected to call a cFunc function from a C program. This cFunc
function contains the logic for creating a TCP client and sending the string “Hello, server” to the server.
However, during simulation, I encountered an error in the C program, which reads as follows:
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x22): undefined reference to `__imp_WSAStartup’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x55): undefined reference to `__imp_socket’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x7b): undefined reference to `__imp_WSACleanup’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0xb6): undefined reference to `__imp_htons’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0xde): undefined reference to `inet_pton’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0xff): undefined reference to `__imp_closesocket’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x108): undefined reference to `__imp_WSACleanup’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x132): undefined reference to `__imp_connect’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x156): undefined reference to `__imp_closesocket’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x15f): undefined reference to `__imp_WSACleanup’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x1ab): undefined reference to `__imp_send’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x1cf): undefined reference to `__imp_closesocket’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x1d8): undefined reference to `__imp_WSACleanup’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x205): undefined reference to `__imp_recv’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x233): undefined reference to `__imp_closesocket’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x23c): undefined reference to `__imp_WSACleanup’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x276): undefined reference to `__imp_closesocket’
./xsim.dirworkxscdpi.a(function.win64.obj):function.c:(.text+0x27f): undefined reference to `__imp_WSACleanup’
To provide context, I have included the necessary winsock2.h header in my C program, and I have added the C linker option in the run.bat script as follows
call %install_root%binxsc function.c –gcc_link_options -Lws2_32 “C:WindowsSystem32”
I would greatly appreciate any guidance or assistance you can provide in resolving this issue.
Namratha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.