Only use VPI routine jump table in Windows.
This commit is contained in:
parent
f0326bc9c2
commit
3f1253039a
10
vpi/libvpi.c
10
vpi/libvpi.c
|
|
@ -17,6 +17,8 @@
|
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#if defined(__MINGW32__) || defined (__CYGWIN32__)
|
||||
|
||||
#include "vpi_user.h"
|
||||
|
||||
vpip_routines_s*vpip_routines = 0;
|
||||
|
|
@ -25,3 +27,11 @@ DLLEXPORT void vpip_set_callback(vpip_routines_s*routines)
|
|||
{
|
||||
vpip_routines = routines;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void __libvpi_c_dummy_function(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ vpiHandle vpi_register_systf(const struct t_vpi_systf_data*ss)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__MINGW32__) || defined (__CYGWIN32__)
|
||||
vpip_routines_s vpi_routines = {
|
||||
.register_cb = vpi_register_cb,
|
||||
.remove_cb = vpi_remove_cb,
|
||||
|
|
@ -229,6 +230,7 @@ vpip_routines_s vpi_routines = {
|
|||
};
|
||||
|
||||
typedef void (*vpip_set_callback_t)(vpip_routines_s*);
|
||||
#endif
|
||||
typedef void (*vlog_startup_routines_t)(void);
|
||||
|
||||
bool load_vpi_module(const char*path)
|
||||
|
|
@ -240,6 +242,7 @@ bool load_vpi_module(const char*path)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if defined(__MINGW32__) || defined (__CYGWIN32__)
|
||||
void*function = ivl_dlsym(dll, "vpip_set_callback");
|
||||
if (function == 0) {
|
||||
cerr << "warning: '" << path << "' has no vpip_set_callback()" << endl;
|
||||
|
|
@ -248,6 +251,7 @@ bool load_vpi_module(const char*path)
|
|||
}
|
||||
vpip_set_callback_t set_callback = (vpip_set_callback_t)function;
|
||||
set_callback(&vpi_routines);
|
||||
#endif
|
||||
|
||||
void*table = ivl_dlsym(dll, LU "vlog_startup_routines" TU);
|
||||
if (table == 0) {
|
||||
|
|
|
|||
|
|
@ -675,6 +675,7 @@ extern void vpip_count_drivers(vpiHandle ref, unsigned idx,
|
|||
# define _vpi_at_APV 6
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__) || defined (__CYGWIN32__)
|
||||
/*
|
||||
* In Linux, when loaded, a shared library can automatically bind to functions
|
||||
* provided by its client. In Windows, a DLL can only do this statically at
|
||||
|
|
@ -780,6 +781,8 @@ extern vpip_routines_s*vpip_routines;
|
|||
|
||||
#endif // IVL_VPI_MODULE
|
||||
|
||||
#endif // defined(__MINGW32__) || defined (__CYGWIN32__)
|
||||
|
||||
EXTERN_C_END
|
||||
|
||||
#endif /* VPI_USER_H */
|
||||
|
|
|
|||
|
|
@ -30,7 +30,9 @@
|
|||
static ivl_dll_t*dll_list = 0;
|
||||
static unsigned dll_list_cnt = 0;
|
||||
|
||||
#if defined(__MINGW32__) || defined (__CYGWIN32__)
|
||||
typedef void (*vpip_set_callback_t)(vpip_routines_s*);
|
||||
#endif
|
||||
typedef void (*vlog_startup_routines_t)(void);
|
||||
|
||||
# define VPIP_MODULE_PATH_MAX 64
|
||||
|
|
@ -216,6 +218,7 @@ void vpip_load_module(const char*name)
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(__MINGW32__) || defined (__CYGWIN32__)
|
||||
void*function = ivl_dlsym(dll, "vpip_set_callback");
|
||||
if (function == 0) {
|
||||
fprintf(stderr, "%s: no vpip_set_callback()\n", name);
|
||||
|
|
@ -224,6 +227,7 @@ void vpip_load_module(const char*name)
|
|||
}
|
||||
vpip_set_callback_t set_callback = (vpip_set_callback_t)function;
|
||||
set_callback(&vpi_routines);
|
||||
#endif
|
||||
|
||||
void*table = ivl_dlsym(dll, LU "vlog_startup_routines" TU);
|
||||
if (table == 0) {
|
||||
|
|
|
|||
|
|
@ -1635,6 +1635,7 @@ extern "C" void vpip_count_drivers(vpiHandle ref, unsigned idx,
|
|||
rfp->node->count_drivers(idx, counts);
|
||||
}
|
||||
|
||||
#if defined(__MINGW32__) || defined (__CYGWIN32__)
|
||||
vpip_routines_s vpi_routines = {
|
||||
.register_cb = vpi_register_cb,
|
||||
.remove_cb = vpi_remove_cb,
|
||||
|
|
@ -1678,3 +1679,4 @@ vpip_routines_s vpi_routines = {
|
|||
.mcd_rawwrite = vpip_mcd_rawwrite,
|
||||
.set_return_value = vpip_set_return_value,
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -48,7 +48,9 @@ typedef struct __vpiArray* vvp_array_t;
|
|||
* header file elsewhere.
|
||||
*/
|
||||
|
||||
#if defined(__MINGW32__) || defined (__CYGWIN32__)
|
||||
extern vpip_routines_s vpi_routines;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Routines/definitions used to build the file/line number tracing object.
|
||||
|
|
|
|||
Loading…
Reference in New Issue