diff --git a/msvc/Makefile b/msvc/Makefile index 6c6b60a40..147403126 100644 --- a/msvc/Makefile +++ b/msvc/Makefile @@ -46,6 +46,8 @@ ECL_SOCKETS = ECL_RT = # Defsystem support ECL_DEFSYS = +# Profiling +ECL_PROFILE = # (ECL configuration) # ============================================================= @@ -148,6 +150,10 @@ ECL_FEATURES = (cons :wants-rt $(ECL_FEATURES)) ECL_MODULES = $(ECL_MODULES) defsystem ECL_FEATURES = (cons :wants-defsystem $(ECL_FEATURES)) !endif +!ifdef ECL_PROFILE +ECL_MODULES = $(ECL_MODULES) profile +ECL_FEATURES = (cons :wants-profile $(ECL_FEATURES)) +!endif !MESSAGE $(ECL_MODULES) !MESSAGE $(ECL_FEATURES) diff --git a/msvc/gc/Makefile b/msvc/gc/Makefile index e1299c061..9625f21ad 100644 --- a/msvc/gc/Makefile +++ b/msvc/gc/Makefile @@ -11,10 +11,10 @@ srcdir = ..\..\src\gc !if "$(ECL_THREADS)" != "" THREADS_OBJ= win32_threads.obj -THREADS_FLAGS= -DGC_WIN32_THREADS +THREADS_FLAGS= -DGC_DLL -DGC_BUILD -DGC_WIN32_THREADS !else THREADS_OBJ= -THREADS_FLAGS= +THREADS_FLAGS= -DGC_DLL -DGC_BUILD !endif MFLAGS = /MD diff --git a/src/cmp/cmpmain.lsp b/src/cmp/cmpmain.lsp index fb9d082b5..a6f3de93b 100644 --- a/src/cmp/cmpmain.lsp +++ b/src/cmp/cmpmain.lsp @@ -99,7 +99,7 @@ (let ((lib-file (compile-file-pathname o-pathname :type :lib))) (safe-system (format nil - "dllwrap --export-all-symbols -o ~S -L~S ~{~S ~} ~@?" + "dllwrap -o ~S -L~S ~{~S ~} ~@?" (si::coerce-to-filename o-pathname) (fix-for-mingw (ecl-library-directory)) options diff --git a/src/cmp/cmptop.lsp b/src/cmp/cmptop.lsp index 7cc324cf7..b259a375a 100644 --- a/src/cmp/cmptop.lsp +++ b/src/cmp/cmptop.lsp @@ -123,7 +123,7 @@ (wt-nl1 "#ifdef __cplusplus") (wt-nl1 "extern \"C\"") (wt-nl1 "#endif") - (wt-nl1 "void " name "(cl_object flag)") + (wt-nl1 "ECL_DLLEXPORT void " name "(cl_object flag)") (wt-nl1 "{ VT" *reservation-cmacro* " VLEX" *reservation-cmacro* " CLSR" *reservation-cmacro*) (wt-nl "cl_object value0;") @@ -524,7 +524,7 @@ (wt-comment "... shares definition with " (fun-name (fun-shares-with fun))) (return-from t3local-fun)) (cond ((fun-exported fun) - (wt-nl-h #+msvc "__declspec(dllexport) " "cl_object " cfun "(") + (wt-nl-h "ECL_DLLEXPORT cl_object " cfun "(") (wt-nl1 "cl_object " cfun "(")) (t (wt-nl-h "static cl_object " cfun "(") diff --git a/src/compile.lsp.in b/src/compile.lsp.in index 5d26ea3d8..519e2acf6 100644 --- a/src/compile.lsp.in +++ b/src/compile.lsp.in @@ -102,16 +102,30 @@ ;;; ;;; We do not need the -rpath flag for the library, nor -lecl. ;;; -(let ((c::*ld-shared-flags* #-msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @CORE_LIBS@ @LIBS@ @FASL_LIBS@" - #+msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@") - (c::*cc-flags* (concatenate 'string "-DECL_API -I@true_builddir@/c " c::*cc-flags*))) - (c::shared-cc (compile-file-pathname "ecl" :type :dll) - "c/main.@OBJEXT@" - "c/all_symbols2.@OBJEXT@" - "@LIBPREFIX@lsp.@LIBEXT@" - "@LIBPREFIX@eclmin.@LIBEXT@" - #+darwin - "-Wl,-install_name,@libdir\@/@SHAREDPREFIX@ecl.@SHAREDEXT@")) +(let* ((c::*ld-shared-flags* #-msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @CORE_LIBS@ @LIBS@ @FASL_LIBS@" + #+msvc "@SHARED_LDFLAGS@ @LDFLAGS@ @STATICLIBS@ @CLIBS@") + (c::*cc-flags* (concatenate 'string "-DECL_API -I@true_builddir@/c " c::*cc-flags*)) + (extra-args nil)) + #+darwin + (push "-Wl,-install_name,@libdir\@/@SHAREDPREFIX@ecl.@SHAREDEXT@" + extra-args) + #+(or mingw32 cygwin) + (progn + ;; We need these two to force dllwrap to export the symbols + ;; in these libraries. Otherwise it will not be possible to + ;; call functions from GMP or GC in code that embeds ECL. + (when (probe-file "@LIBPREFIX@eclgc.@LIBEXT@") + (push "@LIBPREFIX@eclgc.@LIBEXT@" extra-args)) + (when (probe-file "@LIBPREFIX@eclgmp.@LIBEXT@") + (push "@LIBPREFIX@eclgmp.@LIBEXT@" extra-args))) + (print extra-args) + (apply #'c::shared-cc + (compile-file-pathname "ecl" :type :dll) + "c/main.@OBJEXT@" + "c/all_symbols2.@OBJEXT@" + "@LIBPREFIX@lsp.@LIBEXT@" + "@LIBPREFIX@eclmin.@LIBEXT@" + extra-args)) ;;; ;;; * Compile and link Common-Lisp to C compiler diff --git a/src/configure b/src/configure index 8d9ae3fe9..8c860c171 100755 --- a/src/configure +++ b/src/configure @@ -12058,7 +12058,7 @@ echo "$as_me: Configuring included Boehm GC library:" >&6;} test -d gc && rm -rf gc if mkdir gc; then (destdir=`${PWDCMD}`; cd gc; \ - CC="${CC} ${PICFLAG}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \ + CC="${CC} ${PICFLAG}" CFLAGS="-DGC_BUILD ${CFLAGS}" LDFLAGS="${LDFLAGS}" \ $srcdir/gc/configure --disable-shared --prefix=${destdir} \ --includedir=${destdir}/ecl/gc/ --libdir=${destdir} --build=${build_alias} \ --host=${host_alias} ${boehm_configure_flags}) diff --git a/src/configure.in b/src/configure.in index 165a6a0c3..e64b9f270 100644 --- a/src/configure.in +++ b/src/configure.in @@ -565,7 +565,7 @@ case "${enable_boehm}" in test -d gc && rm -rf gc if mkdir gc; then (destdir=`${PWDCMD}`; cd gc; \ - CC="${CC} ${PICFLAG}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \ + CC="${CC} ${PICFLAG}" CFLAGS="-DGC_BUILD ${CFLAGS}" LDFLAGS="${LDFLAGS}" \ $srcdir/gc/configure --disable-shared --prefix=${destdir} \ --includedir=${destdir}/ecl/gc/ --libdir=${destdir} --build=${build_alias} \ --host=${host_alias} ${boehm_configure_flags}) diff --git a/src/gc/include/gc_config_macros.h b/src/gc/include/gc_config_macros.h index 1d1a2daac..aa56a1f55 100644 --- a/src/gc/include/gc_config_macros.h +++ b/src/gc/include/gc_config_macros.h @@ -134,27 +134,15 @@ # define GC_DLL #endif -#if defined(__MINGW32__) && defined(GC_DLL) -# ifdef GC_BUILD -# define GC_API __declspec(dllexport) +#if (defined(__WATCOMC__) || defined(__MINGW32__) || defined(__DMC__) || defined(_MSC_VER)) /* && defined(GC_DLL) */ +# ifdef ECL_API +# define GC_API extern ECL_API # else -# define GC_API __declspec(dllimport) -# endif -#endif - -#if (defined(__DMC__) || defined(_MSC_VER)) && defined(GC_DLL) -# ifdef GC_BUILD -# define GC_API extern __declspec(dllexport) -# else -# define GC_API __declspec(dllimport) -# endif -#endif - -#if defined(__WATCOMC__) && defined(GC_DLL) -# ifdef GC_BUILD -# define GC_API extern __declspec(dllexport) -# else -# define GC_API extern __declspec(dllimport) +# ifdef GC_BUILD +# define GC_API extern __declspec(dllexport) +# else +# define GC_API extern __declspec(dllimport) +# endif # endif #endif diff --git a/src/gc/misc.c b/src/gc/misc.c index 3cd156679..2da3ed9e2 100644 --- a/src/gc/misc.c +++ b/src/gc/misc.c @@ -465,7 +465,7 @@ size_t GC_get_bytes_since_gc GC_PROTO(()) return ((size_t) WORDS_TO_BYTES(GC_words_allocd)); } -size_t GC_get_total_bytes GC_PROTO(()) +GC_API size_t GC_get_total_bytes GC_PROTO(()) { return ((size_t) WORDS_TO_BYTES(GC_words_allocd+GC_words_allocd_before_gc)); } diff --git a/src/h/config.h.in b/src/h/config.h.in index fa8351e57..c4f5b8265 100644 --- a/src/h/config.h.in +++ b/src/h/config.h.in @@ -13,6 +13,30 @@ See file '../Copyright' for full details. */ +/* + * If ECL_API has been predefined, that means we are building the core + * library and, under windows, we must tell the compiler to export + * extern functions from the shared library. + * If ECL_API is not defined, we are simply building an application that + * uses ECL and, under windows, we must tell the compiler that certain + * will be imported from a DLL. + */ +#if defined(mingw32) || defined(_MSC_VER) || defined(cygwin) +# define ECL_DLLEXPORT __declspec(dllexport) +# ifdef ECL_API +# undef ECL_API +# define ECL_API __declspec(dllexport) +# else +# define ECL_API __declspec(dllimport) +# endif +#else +# define ECL_DLLEXPORT +# ifdef ECL_API +# undef ECL_API +# endif +# define ECL_API +#endif + /* * FEATURES LINKED IN */ diff --git a/src/h/ecl.h b/src/h/ecl.h index 76e1eea2f..2a1d144de 100644 --- a/src/h/ecl.h +++ b/src/h/ecl.h @@ -57,28 +57,6 @@ typedef unsigned short uint16_t; # define end_critical_section() #endif -/* - * If ECL_API has been predefined, that means we are building the core - * library and, under windows, we must tell the compiler to export - * extern functions from the shared library. - * If ECL_API is not defined, we are simply building an application that - * uses ECL and, under windows, we must tell the compiler that certain - * will be imported from a DLL. - */ -#if defined(mingw32) || defined(_MSC_VER) || defined(cygwin) -# ifdef ECL_API -# undef ECL_API -# define ECL_API __declspec(dllexport) -# else -# define ECL_API __declspec(dllimport) -# endif -#else -# ifdef ECL_API -# undef ECL_API -# endif -# define ECL_API -#endif - #include #include #include diff --git a/src/lsp/config.lsp.in b/src/lsp/config.lsp.in index 455ed0b80..d56ee104e 100644 --- a/src/lsp/config.lsp.in +++ b/src/lsp/config.lsp.in @@ -24,7 +24,7 @@ Returns, as a string, the location of the machine on which ECL runs." (defun lisp-implementation-version () "Args:() Returns the version of your ECL as a string." - "@PACKAGE_VERSION@ (CVS 2008-03-16 13:51)") + "@PACKAGE_VERSION@ (CVS 2008-03-16 21:23)") (defun machine-type () "Args: () diff --git a/src/util/emacs.el b/src/util/emacs.el index d83b66971..cd9ee7142 100644 --- a/src/util/emacs.el +++ b/src/util/emacs.el @@ -360,8 +360,6 @@ "clx/shape.lisp" "clx/text.lisp" "clx/translate.lisp" -"../msvc/ecl.def" -"../msvc/ecl-threads.def" ))) (mapcar 'find-file ecl-files)