Fix for LXT/LXT2 output using MinGW.
When using MinGW, routines registered via atexit() inside a DLL are only called when the DLL is detached. If not detached manually, DLLs are automatically detached *after* all remaining open files are closed. This meant that by the time the LXT or LXT2 close_dumpfile routine was called, the dump file handle was no longer valid, so any remaining output was lost. This patch fixes the problem by manually detaching the VPI modules.
This commit is contained in:
parent
fad5e362ce
commit
4818db887e
|
|
@ -464,12 +464,18 @@ int main(int argc, char*argv[])
|
|||
modpath_delete();
|
||||
vpi_handle_delete();
|
||||
udp_defns_delete();
|
||||
load_module_delete();
|
||||
island_delete();
|
||||
signal_pool_delete();
|
||||
vvp_net_pool_delete();
|
||||
ufunc_pool_delete();
|
||||
#endif
|
||||
/*
|
||||
* Unload the VPI modules. This is essential for MinGW, to ensure
|
||||
* dump files are flushed before the main process terminates, as
|
||||
* the DLL termination code is called after all remaining open
|
||||
* files are automatically closed.
|
||||
*/
|
||||
load_module_delete();
|
||||
|
||||
return vvp_return_value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,18 +20,14 @@
|
|||
# include "config.h"
|
||||
# include "vpi_priv.h"
|
||||
# include "ivl_dlfcn.h"
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
# include "vvp_cleanup.h"
|
||||
#endif
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
static ivl_dll_t*dll_list = 0;
|
||||
static unsigned dll_list_cnt = 0;
|
||||
#endif
|
||||
|
||||
typedef void (*vlog_startup_routines_t)(void);
|
||||
|
||||
|
|
@ -55,7 +51,6 @@ unsigned vpip_module_path_cnt = 0
|
|||
#endif
|
||||
;
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
void load_module_delete(void)
|
||||
{
|
||||
for (unsigned idx = 0; idx < dll_list_cnt; idx += 1) {
|
||||
|
|
@ -65,7 +60,6 @@ void load_module_delete(void)
|
|||
dll_list = 0;
|
||||
dll_list_cnt = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void vpip_load_module(const char*name)
|
||||
{
|
||||
|
|
@ -162,12 +156,10 @@ void vpip_load_module(const char*name)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CHECK_WITH_VALGRIND
|
||||
/* Add the dll to the list so it can be closed when we are done. */
|
||||
dll_list_cnt += 1;
|
||||
dll_list = (ivl_dll_t*)realloc(dll_list, dll_list_cnt*sizeof(ivl_dll_t));
|
||||
dll_list[dll_list_cnt-1] = dll;
|
||||
#endif
|
||||
|
||||
vpi_mode_flag = VPI_MODE_REGISTER;
|
||||
vlog_startup_routines_t*routines = (vlog_startup_routines_t*)table;
|
||||
|
|
|
|||
Loading…
Reference in New Issue