In Windows, export VPI functions from vvp.exe (GitHub issue #395)
This is to support cocotb, who don't use our vpi_user.h and libvpi.a,
instead building their own import library to directly link to vvp.
(cherry picked from commit 159af4d4ba)
This commit is contained in:
parent
55e2c5abef
commit
4598341e85
|
|
@ -38,6 +38,7 @@ HOSTCFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CC@ @CFLAGS@
|
|||
BUILDCC = @CC_FOR_BUILD@
|
||||
BUILDEXT = @BUILD_EXEEXT@
|
||||
CXX = @CXX@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
|
|
@ -118,8 +119,22 @@ Makefile: $(srcdir)/Makefile.in
|
|||
dep:
|
||||
mkdir dep
|
||||
|
||||
ifeq (@WIN32@,yes)
|
||||
# To support cocotb, we export the VPI functions directly. This allows
|
||||
# cocotb to build VPI modules without using our vpi_user.h and libvpi.a.
|
||||
# This requires making the vvp.exe in two steps. The first step makes
|
||||
# a vvp.exe that dlltool can use to make an export library, and the
|
||||
# second step makes a vvp.exe that really exports those things.
|
||||
vvp@EXEEXT@: $O $(srcdir)/vvp.def
|
||||
$(CXX) -o vvp$(suffix)@EXEEXT@ $(LDFLAGS) $O $(dllib) $(LIBS)
|
||||
$(DLLTOOL) --dllname vvp$(suffix)@EXEEXT@ --def $(srcdir)/vvp.def \
|
||||
--output-exp vvp.exp
|
||||
rm -f vvp$(suffix)@EXEEXT@
|
||||
$(CXX) $(LDFLAGS) -o vvp@EXEEXT@ vvp.exp $(LDFLAGS) $O $(dllib) $(LIBS)
|
||||
else
|
||||
vvp@EXEEXT@: $O
|
||||
$(CXX) $(LDFLAGS) -o vvp@EXEEXT@ $O $(LIBS) $(dllib)
|
||||
endif
|
||||
|
||||
%.o: %.cc config.h
|
||||
$(CXX) $(CPPFLAGS) -DIVL_SUFFIX='"$(suffix)"' $(MDIR1) $(MDIR2) $(CXXFLAGS) @DEPENDENCY_FLAG@ -c $< -o $*.o
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2019 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2020 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -221,16 +221,13 @@ void vpip_load_module(const char*name)
|
|||
|
||||
#if defined(__MINGW32__) || defined (__CYGWIN__)
|
||||
void*function = ivl_dlsym(dll, "vpip_set_callback");
|
||||
if (function == 0) {
|
||||
fprintf(stderr, "%s: no vpip_set_callback()\n", name);
|
||||
ivl_dlclose(dll);
|
||||
return;
|
||||
}
|
||||
vpip_set_callback_t set_callback = (vpip_set_callback_t)function;
|
||||
if (!set_callback(&vpi_routines, vpip_routines_version)) {
|
||||
fprintf(stderr, "Failed to link VPI module %s. Try rebuilding it with iverilog-vpi.\n", name);
|
||||
ivl_dlclose(dll);
|
||||
return;
|
||||
if (function) {
|
||||
vpip_set_callback_t set_callback = (vpip_set_callback_t)function;
|
||||
if (!set_callback(&vpi_routines, vpip_routines_version)) {
|
||||
fprintf(stderr, "Failed to link VPI module %s. Try rebuilding it with iverilog-vpi.\n", name);
|
||||
ivl_dlclose(dll);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
EXPORTS
|
||||
|
||||
vpi_chk_error
|
||||
vpi_compare_objects
|
||||
vpi_control
|
||||
vpi_flush
|
||||
vpi_fopen
|
||||
vpi_free_object
|
||||
vpi_get
|
||||
vpi_get_delays
|
||||
vpi_get_file
|
||||
vpi_get_str
|
||||
vpi_get_systf_info
|
||||
vpi_get_time
|
||||
vpi_get_userdata
|
||||
vpi_get_value
|
||||
vpi_get_vlog_info
|
||||
vpi_handle
|
||||
vpi_handle_by_index
|
||||
vpi_handle_by_name
|
||||
vpi_iterate
|
||||
vpi_mcd_close
|
||||
vpi_mcd_flush
|
||||
vpi_mcd_name
|
||||
vpi_mcd_open
|
||||
vpi_mcd_printf
|
||||
vpi_mcd_vprintf
|
||||
vpi_printf
|
||||
vpi_put_delays
|
||||
vpi_put_userdata
|
||||
vpi_put_value
|
||||
vpi_register_cb
|
||||
vpi_register_systf
|
||||
vpi_remove_cb
|
||||
vpi_scan
|
||||
vpi_sim_control
|
||||
vpi_sim_vcontrol
|
||||
vpi_vprintf
|
||||
|
||||
vpip_calc_clog2
|
||||
vpip_count_drivers
|
||||
vpip_format_strength
|
||||
vpip_make_systf_system_defined
|
||||
vpip_mcd_rawwrite
|
||||
vpip_set_return_value
|
||||
Loading…
Reference in New Issue