From cbd501b865a1b99162471697362652d35ae9a460 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 30 Sep 2001 16:45:10 +0000 Subject: [PATCH] Fix some Cygwin DLL handling. (Venkat Iyer) --- configure.in | 5 +---- cygwin.txt | 28 ++-------------------------- ivl_target.h | 13 ++++++++++++- tgt-fpga/configure.in | 5 +---- tgt-null/null.c | 10 ++++------ tgt-pal/imain.c | 10 ++++------ tgt-stub/stub.c | 9 ++++----- tgt-verilog/verilog.c | 9 ++++----- tgt-vvp/configure.in | 5 +---- tgt-vvp/vvp.c | 9 +++------ vpi/sys_table.c | 9 ++++----- vpip/configure.in | 5 +---- vpip/vpi_systask.c | 10 ++++------ 13 files changed, 45 insertions(+), 82 deletions(-) diff --git a/configure.in b/configure.in index fceabf67b..d9cbc0894 100644 --- a/configure.in +++ b/configure.in @@ -199,10 +199,7 @@ shared=-shared case "${host}" in *-*-cygwin*) - shared="-mdll -Wl,--enable-auto-image-base" - if test $ac_cv_mingw32 = yes; then - shared="-shared -Wl,--enable-auto-image-base" - fi + shared="-shared -Wl,--enable-auto-image-base" ;; *-*-hpux*) diff --git a/cygwin.txt b/cygwin.txt index 378479623..790e5f61a 100644 --- a/cygwin.txt +++ b/cygwin.txt @@ -6,41 +6,17 @@ To build using cygwin: Prerequisites: o Latest net release (1.1.4) of cygwin (sources.redhat.com/cygwin) - o autoconf version 2.13 (or later) from cygutils (cygutils.netpedia.net) - o cvs (1.10.8 or later) also from cygutils Procedure: o Get the source code - see the main icarus verilog page for how to do this o cd to the verilog directory - o autoconf + o autoconf.sh o ./configure o make o make install -That's all that's needed. But there're two common problems during -the make phase. All steps are in the verilog directory. - -1. - -If gcc dies saying virtual memory exhausted while compiling parse.c - then recompile with -O1 or without -O flag and do these steps to - continue - o make CXXFLAGS='' parse.o - o make - -2. - -If gcc dies in the vpi directory while compiling vpi_systask.c with the - error, conflicting types for `_cygwin_dll_entry', then fix the line in - /usr/include/cygwin/cygwin_dll.h. Change the line: - - int WINAPI _cygwin_dll_entry (HANDLE h, DWORD reason, void *ptr); \ -to - int WINAPI _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr); \ - - Note the change from HANDLE to HINSTANCE. Then do - o make +That's all that's needed. To build your own extensions - just include vpi_user.h and link with a command like this: diff --git a/ivl_target.h b/ivl_target.h index 6eca12fc7..3bc0a1b73 100644 --- a/ivl_target.h +++ b/ivl_target.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: ivl_target.h,v 1.82 2001/09/16 22:19:42 steve Exp $" +#ident "$Id: ivl_target.h,v 1.83 2001/09/30 16:45:10 steve Exp $" #endif #ifdef __cplusplus @@ -938,6 +938,14 @@ extern ivl_expr_t ivl_stmt_rval(ivl_statement_t net); extern ivl_statement_t ivl_stmt_sub_stmt(ivl_statement_t net); +#if defined(__MINGW32__) || defined (__CYGWIN32__) +# define DLLEXPORT __declspec(dllexport) +#else +# define DLLEXPORT +#endif + +extern DLLEXPORT int target_design(ivl_design_t des); + /* target_design @@ -955,6 +963,9 @@ _END_DECL /* * $Log: ivl_target.h,v $ + * Revision 1.83 2001/09/30 16:45:10 steve + * Fix some Cygwin DLL handling. (Venkat Iyer) + * * Revision 1.82 2001/09/16 22:19:42 steve * Support attributes to logic gates. * diff --git a/tgt-fpga/configure.in b/tgt-fpga/configure.in index a0c78465f..ef405d558 100644 --- a/tgt-fpga/configure.in +++ b/tgt-fpga/configure.in @@ -37,10 +37,7 @@ shared=-shared case "${host}" in *-*-cygwin*) - shared="-mdll -Wl,--enable-auto-image-base" - if test $ac_cv_mingw32 = yes; then - shared="-shared -Wl,--enable-auto-image-base" - fi + shared="-shared -Wl,--enable-auto-image-base" ;; *-*-hpux*) diff --git a/tgt-null/null.c b/tgt-null/null.c index 6beb46059..52ea9d52e 100644 --- a/tgt-null/null.c +++ b/tgt-null/null.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: null.c,v 1.5 2001/07/25 03:10:50 steve Exp $" +#ident "$Id: null.c,v 1.6 2001/09/30 16:45:10 steve Exp $" #endif # include "config.h" @@ -34,13 +34,11 @@ int target_design(ivl_design_t des) return 0; } -#if defined (__CYGWIN32__) -#include -DECLARE_CYGWIN_DLL(DllMain); -#endif - /* * $Log: null.c,v $ + * Revision 1.6 2001/09/30 16:45:10 steve + * Fix some Cygwin DLL handling. (Venkat Iyer) + * * Revision 1.5 2001/07/25 03:10:50 steve * Create a config.h.in file to hold all the config * junk, and support gcc 3.0. (Stephan Boettcher) diff --git a/tgt-pal/imain.c b/tgt-pal/imain.c index e0df05035..09dafbde7 100644 --- a/tgt-pal/imain.c +++ b/tgt-pal/imain.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: imain.c,v 1.9 2001/09/15 18:27:04 steve Exp $" +#ident "$Id: imain.c,v 1.10 2001/09/30 16:45:10 steve Exp $" #endif # include "config.h" @@ -147,13 +147,11 @@ int target_design(ivl_design_t des) return 0; } -#if defined(__MINGW32__) || defined (__CYGWIN32__) -#include -DECLARE_CYGWIN_DLL(DllMain); -#endif - /* * $Log: imain.c,v $ + * Revision 1.10 2001/09/30 16:45:10 steve + * Fix some Cygwin DLL handling. (Venkat Iyer) + * * Revision 1.9 2001/09/15 18:27:04 steve * Make configure detect malloc.h * diff --git a/tgt-stub/stub.c b/tgt-stub/stub.c index 9013e9440..0802d79ce 100644 --- a/tgt-stub/stub.c +++ b/tgt-stub/stub.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: stub.c,v 1.49 2001/07/25 03:10:50 steve Exp $" +#ident "$Id: stub.c,v 1.50 2001/09/30 16:45:10 steve Exp $" #endif # include "config.h" @@ -603,13 +603,12 @@ int target_design(ivl_design_t des) return 0; } -#if defined (__CYGWIN32__) -#include -DECLARE_CYGWIN_DLL(DllMain); -#endif /* * $Log: stub.c,v $ + * Revision 1.50 2001/09/30 16:45:10 steve + * Fix some Cygwin DLL handling. (Venkat Iyer) + * * Revision 1.49 2001/07/25 03:10:50 steve * Create a config.h.in file to hold all the config * junk, and support gcc 3.0. (Stephan Boettcher) diff --git a/tgt-verilog/verilog.c b/tgt-verilog/verilog.c index a63a7f35d..c81f0633a 100644 --- a/tgt-verilog/verilog.c +++ b/tgt-verilog/verilog.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: verilog.c,v 1.24 2001/07/25 03:10:50 steve Exp $" +#ident "$Id: verilog.c,v 1.25 2001/09/30 16:45:10 steve Exp $" #endif # include "config.h" @@ -436,13 +436,12 @@ int target_design(ivl_design_t des) } -#if defined (__CYGWIN32__) -#include -DECLARE_CYGWIN_DLL(DllMain); -#endif /* * $Log: verilog.c,v $ + * Revision 1.25 2001/09/30 16:45:10 steve + * Fix some Cygwin DLL handling. (Venkat Iyer) + * * Revision 1.24 2001/07/25 03:10:50 steve * Create a config.h.in file to hold all the config * junk, and support gcc 3.0. (Stephan Boettcher) diff --git a/tgt-vvp/configure.in b/tgt-vvp/configure.in index dcff06dfe..654f71e82 100644 --- a/tgt-vvp/configure.in +++ b/tgt-vvp/configure.in @@ -37,10 +37,7 @@ shared=-shared case "${host}" in *-*-cygwin*) - shared="-mdll -Wl,--enable-auto-image-base" - if test $ac_cv_mingw32 = yes; then - shared="-shared -Wl,--enable-auto-image-base" - fi + shared="-shared -Wl,--enable-auto-image-base" ;; *-*-hpux*) diff --git a/tgt-vvp/vvp.c b/tgt-vvp/vvp.c index 3eca34cc3..5b875dbe8 100644 --- a/tgt-vvp/vvp.c +++ b/tgt-vvp/vvp.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vvp.c,v 1.11 2001/07/30 02:44:05 steve Exp $" +#ident "$Id: vvp.c,v 1.12 2001/09/30 16:45:10 steve Exp $" #endif /* @@ -62,7 +62,9 @@ inline static void draw_module_declarations(ivl_design_t des) } } + int target_design(ivl_design_t des) + { int rc; ivl_scope_t root; @@ -98,11 +100,6 @@ int target_design(ivl_design_t des) return rc; } -#if defined (__CYGWIN32__) -#include -DECLARE_CYGWIN_DLL(DllMain); -#endif - /* */ diff --git a/vpi/sys_table.c b/vpi/sys_table.c index a035cb909..9bcace1b8 100644 --- a/vpi/sys_table.c +++ b/vpi/sys_table.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: sys_table.c,v 1.12 2001/07/25 03:10:50 steve Exp $" +#ident "$Id: sys_table.c,v 1.13 2001/09/30 16:45:10 steve Exp $" #endif # include "config.h" @@ -42,13 +42,12 @@ void (*vlog_startup_routines[])() = { 0 }; -#if defined (__CYGWIN32__) -#include -DECLARE_CYGWIN_DLL(DllMain); -#endif /* * $Log: sys_table.c,v $ + * Revision 1.13 2001/09/30 16:45:10 steve + * Fix some Cygwin DLL handling. (Venkat Iyer) + * * Revision 1.12 2001/07/25 03:10:50 steve * Create a config.h.in file to hold all the config * junk, and support gcc 3.0. (Stephan Boettcher) diff --git a/vpip/configure.in b/vpip/configure.in index c8ae96422..ffdfa5328 100644 --- a/vpip/configure.in +++ b/vpip/configure.in @@ -15,10 +15,7 @@ shared=-shared EXTRALIBS= case "${host}" in *-*-cygwin*) - shared="-mdll -Wl,--enable-auto-image-base" - if test $ac_cv_mingw32 = yes; then - shared="-shared -Wl,--enable-auto-image-base" - fi + shared="-shared -Wl,--enable-auto-image-base" WIN32=yes ;; *-*-hpux*) diff --git a/vpip/vpi_systask.c b/vpip/vpi_systask.c index 4b0b2851d..9be876434 100644 --- a/vpip/vpi_systask.c +++ b/vpip/vpi_systask.c @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) && !defined(macintosh) -#ident "$Id: vpi_systask.c,v 1.3 2001/05/22 02:14:47 steve Exp $" +#ident "$Id: vpi_systask.c,v 1.4 2001/09/30 16:45:10 steve Exp $" #endif # include "vpi_priv.h" @@ -118,13 +118,11 @@ const struct __vpirt *vpip_get_sysfunc_rt(void) return &vpip_sysfunc_rt; } -#if defined (__CYGWIN32__) -#include -DECLARE_CYGWIN_DLL(DllMain); -#endif - /* * $Log: vpi_systask.c,v $ + * Revision 1.4 2001/09/30 16:45:10 steve + * Fix some Cygwin DLL handling. (Venkat Iyer) + * * Revision 1.3 2001/05/22 02:14:47 steve * Update the mingw build to not require cygwin files. *