The symbols from Boehm-Weiser garbage collector are now exported from the DLL also in Windows. This means PROFILE can be built there. In addition, under mingw32 we now only export symbols which have been marked with dllexport.

This commit is contained in:
jgarcia 2008-03-17 08:28:20 +00:00
parent dc8033ee7e
commit 2cb141c3ba
13 changed files with 71 additions and 63 deletions

View file

@ -46,6 +46,8 @@ ECL_SOCKETS =
ECL_RT =
# Defsystem support
ECL_DEFSYS =
# Profiling
ECL_PROFILE =
# <END> (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)

View file

@ -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

View file

@ -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

View file

@ -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 "(")

View file

@ -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

2
src/configure vendored
View file

@ -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})

View file

@ -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})

View file

@ -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

View file

@ -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));
}

View file

@ -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
*/

View file

@ -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 <ecl/object.h>
#include <ecl/stacks.h>
#include <ecl/external.h>

View file

@ -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: ()

View file

@ -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)