Ralf Wildenhues wrote:

Thanks also for the documentation suggestion.  Slightly rewritten
suggestion to come up.

Ping? [antecedent reposted below]

--
Chuck

Around line 3546 [probably 4476, now] in libtool.texi, something like:

--------------------------%<----------------------------
@emph{Win32 specific} When building a DLL on windows (MinGW,Cygwin) that uses @code{libltdl} as a convenience archive, there are some issues with symbol decoration that must be carefully managed. You must do one of the following, within the code and/or build machinery of your library:

@enumerate 1
@item explicitly mark as @code{declspec(dllexport)} all symbols in your library that should be exported when building your library's source code. However, these symbols should @emph{not} be marked @code{declspec(dllexport)} when building @emph{clients} of your library -- instead, the symbols should be marked @code{declspec(dllimport)}. This procedure will require careful macro design within your library's public header files. An example of this may be found in @file{zlib.h} from the zlib distribution @url{http://www.zlib.net/}.

@item use the (win32-specific) linker option @code{-Xlinker --export-all-symbols}. This will restore the expected "auto-export" behavior of the GNU linker on windows. However, the @code{--export-all-symbols} option is specific to the GNU linker's i386 PE target -- @code{ld} for other targets will not recognize the option. Therefore, using this option will require careful coding in your library's @file{Makefile.am} and @file{configure.ac}. For example:

configure.ac:
@example
...
case $host_os in
cygwin* | mingw* | pw32*)
  RESTORE_AUTOEXPORT="-Xlinker --export-all-symbols"
  ;;
*)
  RESTORE_AUTOEXPORT=
  ;;
esac
AC_SUBST(RESTORE_AUTOEXPORT)
...
@end example

Makefile.am
@example
...
libmylibrary_la_LDFLAGS = -no-undefined $(RESTORE_AUTOEXPORT)
...
@end example

@item Use libtool facilities to mimic @code{--export-all-symbols}. Unlike the solution above, this solution has the advantage of requiring no platform-specific workarounds. Simply append @code{-export-symbols-regex ".*"} to the @code{_LDFLAGS} for your library:

Makefile.am
@example
...
libmylibrary_la_LDFLAGS = -no-undefined -export-symbols-regex ".*"
...
@end example
@end enumerate
--------------------------%<----------------------------


Reply via email to