[PATCH] Build libgcj, libgcj-tools, and libffi as shared libraries on Windows

Charles Wilson cygwin@cwilson.fastmail.fm
Sun Aug 24 23:00:00 GMT 2008


Why was this necessary:

	<libjava/libltdl>
	* ltdl.c (DLL_EXPORT): Rename to LIBLTDL_DLL_EXPORT.
	* ltdl.h (DLL_EXPORT): Rename to LIBLTDL_DLL_EXPORT.

AFAIK, this new symbol LIBLDL_DLLEXPORT, is never defined by libtool,
even when building libjava shared.  So the symbols decorated with
LT_SCOPE will never get the __declspec(dllexport) annotation.

Or was that the intention, in order to work around the issue where ld
disables its default auto-export behavior, when it sees ANY symbol
explicitly marked as __declspec(dllexport)?  From ld info:

          If, however, `--export-all-symbols' is not given explicitly
          on the command line, then the default auto-export behavior
          will be _disabled_ if either of the following are true:

             * A DEF file is used.

             * Any symbol in any object file was marked with the
               __declspec(dllexport) attribute.


If so, then the comment:
+#  ifdef LIBLTDL_DLL_EXPORT /* defined by libtool (if required) */
is wrong; it should be something like
   /* !not! 'DLL_EXPORT'; we don't want libtool to
      automatically decorate just these exports without
      also decorating every other libjava export
   */

But finally, there's one last issue: I thought one of the gcc guidelines
going forward with respect to autotools was to NOT modify imported
files.  These changes will be lost every time somebody resyncs with
upstream libtool...


Wouldn't it make more sense, until there are proper __declspec()
markings/macros on all desired libjava exports, to leave these source
files alone and just explicitly use -Wl,--enable-auto-export when
linking the libjava DLL on mingw/cygwin?  Then, the mere presence of a
few decorated symbols from ltdl.c won't "turn off" the auto-export of
all the other libjava symbols.

--
Chuck



More information about the Gcc-patches mailing list