|
List Info
Thread: windows static for dll builds
|
|
| windows static for dll builds |

|
2006-08-22 11:45:17 |
I need to start using static builds with the
LIBXML_STATIC_FOR_DLL flag
and would like to make a couple of changes in order to
facilitate
building them.
First - change the calling convention of xmlDllMain. I have
no idea how
(or if) anyone is actually building with this flag, but
xmlDllMain is
using the stdcall calling convention, while everything else
is built
using the one specified by XMLCALL making it impossible to
link to this
function correctly.
BOOL WINAPI xmlDllMain(...
to BOOL XMLCALL xmlDllMain(
If anyone in some bizarre manner is somehow actually using
this as it is
right now, this change would probably break their usage.
Next - Right now the Makefile has to be manually edited to
add the
LIBXML_STATIC_FOR_DLL flag. I would like to add the ability
to have this
automatically performed by maybe a argument for configure
script. This
now brings up another question on whether the resulting
library should
still be called libxml2_a.lib or whether a third library
should be
produced to be able to distinguish between them
(libxml2_a_dll.lib or
something along those lines).
Personally I would like to see all 3 libs built by default
and would
like to hear anyone's opinion on this (especially since
this would
affect anyone distributing the binaries by the increase in
size).
Rob
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| windows static for dll builds |

|
2006-08-22 19:44:14 |
On 22.08.2006 13:45, Rob Richards wrote:
> I need to start using static builds with the
LIBXML_STATIC_FOR_DLL flag
> and would like to make a couple of changes in order to
facilitate
> building them.
Okay.
> First - change the calling convention of xmlDllMain. I
have no idea how
> (or if) anyone is actually building with this flag, but
xmlDllMain is
> using the stdcall calling convention, while everything
else is built
> using the one specified by XMLCALL making it impossible
to link to this
> function correctly.
Why that?
> BOOL WINAPI xmlDllMain(...
> to BOOL XMLCALL xmlDllMain(
> If anyone in some bizarre manner is somehow actually
using this as it is
> right now, this change would probably break their
usage.
That shouldn't break, I guess. All functions state
explicitly how they
should be linked to, but who knows? The really bizarre thing
are the
bewitched build environments which make two different static
libraries
necessary. But, I, highly addicted to dynamic linking, wish
to have no
say in this.
> Next - Right now the Makefile has to be manually edited
to add the
> LIBXML_STATIC_FOR_DLL flag. I would like to add the
ability to have this
> automatically performed by maybe a argument for
configure script. This
> now brings up another question on whether the resulting
library should
> still be called libxml2_a.lib or whether a third
library should be
> produced to be able to distinguish between them
(libxml2_a_dll.lib or
> something along those lines).
Since a directory on the disc cannot contain two files with
the same
name on all known filesystems, it would be good if the name
were
different to what other files in the same directory are
called.
> Personally I would like to see all 3 libs built by
default and would
> like to hear anyone's opinion on this (especially
since this would
> affect anyone distributing the binaries by the increase
in size).
Those who distribute the binaries will more likely be
affected by
upcoming posts, as users will have just 33% chance to link
to the right
library instead of 50% they have now and, seen
statistically, will fail
more often
I could't care less for this static-for-dll thing and have
no problems
with adding another library to the binary distribution, as
long it is
built and packaged in the same breath with the others (see
make bindist
target). If others are at a peace with it, I would say make
a patch and
post it here.
Ciao,
Igor
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| windows static for dll builds |

|
2006-08-22 22:00:55 |
Igor Zlatkovic wrote:
> On 22.08.2006 13:45, Rob Richards wrote:
>
>> First - change the calling convention of
xmlDllMain. I have no idea how
>> (or if) anyone is actually building with this flag,
but xmlDllMain is
>> using the stdcall calling convention, while
everything else is built
>> using the one specified by XMLCALL making it
impossible to link to this
>> function correctly.
>>
>
> Why that?
>
Currently there is no prototype in the header file so it
doesn't
indicate the type of linking and I was trying to get this to
work
without affecting other areas. By changing it to XMLCALL, I
was able to
get away not having to add a prototype to the header (though
I would get
a compiler warning in some cases when linking in some
cases). Adding the
prototype, as is, requires the windows.h file, but that
leads to
conflicts in catalog.c (macro redefinitions).
Without having to dive into catalog issue, I guess the
prototype could
be written something like:
int XMLCALL xmlDllMain(unsigned short hinstDLL, unsigned
long fdwReason,
void *lpvReserved);
...or just leave it without a header and change the WINAPI
to XMLCALL
As it seems there are few to no others using the static for
dll build, I
was leaning to making the fewest changes possible.
>
>> BOOL WINAPI xmlDllMain(...
>> to BOOL XMLCALL xmlDllMain(
>> If anyone in some bizarre manner is somehow
actually using this as it is
>> right now, this change would probably break their
usage.
>>
>
> That shouldn't break, I guess. All functions state
explicitly how they
> should be linked to, but who knows? The really bizarre
thing are the
> bewitched build environments which make two different
static libraries
> necessary. But, I, highly addicted to dynamic linking,
wish to have no
> say in this.
>
It was decided a few years back to build statically and I
never ran into
problems until IIS on Win 2003 - thus requiring this change
in builds.
>
>> Next - Right now the Makefile has to be manually
edited to add the
>> LIBXML_STATIC_FOR_DLL flag. I would like to add the
ability to have this
>> automatically performed by maybe a argument for
configure script. This
>> now brings up another question on whether the
resulting library should
>> still be called libxml2_a.lib or whether a third
library should be
>> produced to be able to distinguish between them
(libxml2_a_dll.lib or
>> something along those lines).
>>
>
> Since a directory on the disc cannot contain two files
with the same
> name on all known filesystems, it would be good if the
name were
> different to what other files in the same directory are
called.
>
Wasn't sure what anyone would think of the 3 lib idea so
have been just
building 1 static lib depending which one I needed and
calling it
libxml2_a.lib
>
>> Personally I would like to see all 3 libs built by
default and would
>> like to hear anyone's opinion on this (especially
since this would
>> affect anyone distributing the binaries by the
increase in size).
>>
>
> Those who distribute the binaries will more likely be
affected by
> upcoming posts, as users will have just 33% chance to
link to the right
> library instead of 50% they have now and, seen
statistically, will fail
> more often
>
> I could't care less for this static-for-dll thing and
have no problems
> with adding another library to the binary distribution,
as long it is
> built and packaged in the same breath with the others
(see make bindist
> target). If others are at a peace with it, I would say
make a patch and
> post it here.
>
Thanks. My intentions are to get it integrated with the rest
of the
build seamlessly. Just to be clear, this is a bit of a
selfish request.
I am just trying to make it easier for someone else to be
able to build
the library without having to learn all the voodoo or always
having to
rely on my releases.
Rob
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| windows static for dll builds |

|
2006-08-22 22:06:43 |
Rob Richards wrote:
> Without having to dive into catalog issue, I guess the
prototype could
> be written something like:
> int XMLCALL xmlDllMain(unsigned short hinstDLL,
unsigned long fdwReason,
> void *lpvReserved);
> ...or just leave it without a header and change the
WINAPI to XMLCALL
>
correction - prototype above should have been:
int XMLCALL xmlDllMain(void *hinstDLL, unsigned long
fdwReason, void
*lpvReserved);
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
| windows static for dll builds |

|
2006-08-23 11:59:00 |
Igor Zlatkovic wrote:
> I could't care less for this static-for-dll thing and
have no problems
> with adding another library to the binary distribution,
as long it is
> built and packaged in the same breath with the others
(see make bindist
> target). If others are at a peace with it, I would say
make a patch and
> post it here.
>
Here's the patch for the build (only for msvc) as well as
the change to
use XMLCALL for xmlDllMain.
The new lib is named libxml2_a_dll.lib
Rob
Index: threads.c
============================================================
=======
RCS file: /cvs/gnome/gnome-xml/threads.c,v
retrieving revision 1.37
diff -c -r1.37 threads.c
*** threads.c 29 Jun 2006 11:50:18 -0000 1.37
--- threads.c 22 Aug 2006 21:28:51 -0000
***************
*** 829,835 ****
*/
#if defined(HAVE_WIN32_THREADS) &&
!defined(HAVE_COMPILER_TLS) &&
(!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
! BOOL WINAPI xmlDllMain(HINSTANCE hinstDLL, DWORD
fdwReason, LPVOID lpvReserved)
#else
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
LPVOID lpvReserved)
#endif
--- 829,835 ----
*/
#if defined(HAVE_WIN32_THREADS) &&
!defined(HAVE_COMPILER_TLS) &&
(!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
#if defined(LIBXML_STATIC_FOR_DLL)
! BOOL XMLCALL xmlDllMain(HINSTANCE hinstDLL, DWORD
fdwReason, LPVOID lpvReserved)
#else
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
LPVOID lpvReserved)
#endif
Index: win32/Makefile.msvc
============================================================
=======
RCS file: /cvs/gnome/gnome-xml/win32/Makefile.msvc,v
retrieving revision 1.31
diff -c -r1.31 Makefile.msvc
*** win32/Makefile.msvc 1 Feb 2006 11:28:14 -0000 1.31
--- win32/Makefile.msvc 23 Aug 2006 10:31:27 -0000
***************
*** 25,35 ****
--- 25,37 ----
XML_IMP = $(XML_BASENAME).lib
XML_DEF = $(XML_BASENAME).def
XML_A = $(XML_BASENAME)_a.lib
+ XML_A_DLL = $(XML_BASENAME)_a_dll.lib
# Place where we let the compiler put its output.
BINDIR = bin.msvc
XML_INTDIR = int.msvc
XML_INTDIR_A = int.a.msvc
+ XML_INTDIR_A_DLL = int.a.dll.msvc
UTILS_INTDIR = int.utils.msvc
# The preprocessor and its options.
***************
*** 181,186 ****
--- 183,233 ----
$(XML_INTDIR_A)\xpointer.obj\
$(XML_INTDIR_A)\xmlstring.obj
+ # Static libxml object files.
+ XML_OBJS_A_DLL = $(XML_INTDIR_A_DLL)\c14n.obj\
+ $(XML_INTDIR_A_DLL)\catalog.obj\
+ $(XML_INTDIR_A_DLL)\chvalid.obj\
+ $(XML_INTDIR_A_DLL)\debugXML.obj\
+ $(XML_INTDIR_A_DLL)\dict.obj\
+ $(XML_INTDIR_A_DLL)\DOCBparser.obj\
+ $(XML_INTDIR_A_DLL)\encoding.obj\
+ $(XML_INTDIR_A_DLL)\entities.obj\
+ $(XML_INTDIR_A_DLL)\error.obj\
+ $(XML_INTDIR_A_DLL)\globals.obj\
+ $(XML_INTDIR_A_DLL)\hash.obj\
+ $(XML_INTDIR_A_DLL)\HTMLparser.obj\
+ $(XML_INTDIR_A_DLL)\HTMLtree.obj\
+ $(XML_INTDIR_A_DLL)\legacy.obj\
+ $(XML_INTDIR_A_DLL)\list.obj\
+ $(XML_INTDIR_A_DLL)\nanoftp.obj\
+ $(XML_INTDIR_A_DLL)\nanohttp.obj\
+ $(XML_INTDIR_A_DLL)\parser.obj\
+ $(XML_INTDIR_A_DLL)\parserInternals.obj\
+ $(XML_INTDIR_A_DLL)\pattern.obj\
+ $(XML_INTDIR_A_DLL)\relaxng.obj\
+ $(XML_INTDIR_A_DLL)\SAX2.obj\
+ $(XML_INTDIR_A_DLL)\SAX.obj\
+ $(XML_INTDIR_A_DLL)\schematron.obj\
+ $(XML_INTDIR_A_DLL)\threads.obj\
+ $(XML_INTDIR_A_DLL)\tree.obj\
+ $(XML_INTDIR_A_DLL)\uri.obj\
+ $(XML_INTDIR_A_DLL)\valid.obj\
+ $(XML_INTDIR_A_DLL)\xinclude.obj\
+ $(XML_INTDIR_A_DLL)\xlink.obj\
+ $(XML_INTDIR_A_DLL)\xmlIO.obj\
+ $(XML_INTDIR_A_DLL)\xmlmemory.obj\
+ $(XML_INTDIR_A_DLL)\xmlreader.obj\
+ $(XML_INTDIR_A_DLL)\xmlregexp.obj\
+ $(XML_INTDIR_A_DLL)\xmlmodule.obj\
+ $(XML_INTDIR_A_DLL)\xmlsave.obj\
+ $(XML_INTDIR_A_DLL)\xmlschemas.obj\
+ $(XML_INTDIR_A_DLL)\xmlschemastypes.obj\
+ $(XML_INTDIR_A_DLL)\xmlunicode.obj\
+ $(XML_INTDIR_A_DLL)\xmlwriter.obj\
+ $(XML_INTDIR_A_DLL)\xpath.obj\
+ $(XML_INTDIR_A_DLL)\xpointer.obj\
+ $(XML_INTDIR_A_DLL)\xmlstring.obj
+
# Xmllint and friends executables.
UTILS = $(BINDIR)\xmllint.exe\
$(BINDIR)\xmlcatalog.exe\
***************
*** 206,222 ****
UTILS = $(UTILS) $(BINDIR)\testThreads.exe
!endif
! all : libxml libxmla utils
libxml : $(BINDIR)\$(XML_SO)
libxmla : $(BINDIR)\$(XML_A)
utils : $(UTILS)
clean :
if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR)
if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A)
if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)
if exist $(BINDIR) rmdir /S /Q $(BINDIR)
--- 253,272 ----
UTILS = $(UTILS) $(BINDIR)\testThreads.exe
!endif
! all : libxml libxmla libxmladll utils
libxml : $(BINDIR)\$(XML_SO)
libxmla : $(BINDIR)\$(XML_A)
+ libxmladll : $(BINDIR)\$(XML_A_DLL)
+
utils : $(UTILS)
clean :
if exist $(XML_INTDIR) rmdir /S /Q $(XML_INTDIR)
if exist $(XML_INTDIR_A) rmdir /S /Q $(XML_INTDIR_A)
+ if exist $(XML_INTDIR_A_DLL) rmdir /S /Q
$(XML_INTDIR_A_DLL)
if exist $(UTILS_INTDIR) rmdir /S /Q $(UTILS_INTDIR)
if exist $(BINDIR) rmdir /S /Q $(BINDIR)
***************
*** 234,239 ****
--- 284,290 ----
copy $(XML_SRCDIR)\include\libxml\*.h
$(INCPREFIX)\libxml
copy $(BINDIR)\$(XML_SO) $(SOPREFIX)
copy $(BINDIR)\$(XML_A) $(LIBPREFIX)
+ copy $(BINDIR)\$(XML_A_DLL) $(LIBPREFIX)
copy $(BINDIR)\$(XML_IMP) $(LIBPREFIX)
install : install-libs
***************
*** 266,271 ****
--- 317,326 ----
$(XML_INTDIR_A) :
if not exist $(XML_INTDIR_A) mkdir $(XML_INTDIR_A)
+ # Makes the static for dll libxml intermediate directory.
+ $(XML_INTDIR_A_DLL) :
+ if not exist $(XML_INTDIR_A_DLL) mkdir
$(XML_INTDIR_A_DLL)
+
# An implicit rule for libxml compilation.
{$(XML_SRCDIR)}.c{$(XML_INTDIR)}.obj::
$(CC) $(CFLAGS) /Fo$(XML_INTDIR)\ /c $<
***************
*** 274,285 ****
--- 329,347 ----
{$(XML_SRCDIR)}.c{$(XML_INTDIR_A)}.obj::
$(CC) $(CFLAGS) /D "LIBXML_STATIC"
/Fo$(XML_INTDIR_A)\ /c $<
+ # An implicit rule for static for dll libxml compilation.
+ {$(XML_SRCDIR)}.c{$(XML_INTDIR_A_DLL)}.obj::
+ $(CC) $(CFLAGS) /D "LIBXML_STATIC" /D
"LIBXML_STATIC_FOR_DLL" /Fo$(XML_INTDIR_A_DLL)\
/c $<
+
# Compiles libxml source. Uses the implicit rule for
commands.
$(XML_OBJS) : $(XML_INTDIR)
# Compiles static libxml source. Uses the implicit rule
for commands.
$(XML_OBJS_A) : $(XML_INTDIR_A)
+ # Compiles static for dll libxml source. Uses the implicit
rule for commands.
+ $(XML_OBJS_A_DLL) : $(XML_INTDIR_A_DLL)
+
# Creates the export definition file (DEF) for libxml.
$(XML_INTDIR)\$(XML_DEF) : $(XML_INTDIR) $(XML_DEF).src
$(CPP) $(CPPFLAGS) $(XML_DEF).src >
$(XML_INTDIR)\$(XML_DEF)
***************
*** 297,302 ****
--- 359,367 ----
$(BINDIR)\$(XML_A) : $(BINDIR) $(XML_OBJS_A)
$(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A) $(XML_OBJS_A)
+ # Creates the libxml static for dll archive.
+ $(BINDIR)\$(XML_A_DLL) : $(BINDIR) $(XML_OBJS_A_DLL)
+ $(AR) $(ARFLAGS) /OUT:$(BINDIR)\$(XML_A_DLL)
$(XML_OBJS_A_DLL)
# Makes the utils intermediate directory.
$(UTILS_INTDIR) :
***************
*** 314,320 ****
!endif
# Builds xmllint and friends. Uses the implicit rule for
commands.
! $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml libxmla
# Source dependences should be autogenerated somehow here,
but how to
# do it? I have no clue.
--- 379,385 ----
!endif
# Builds xmllint and friends. Uses the implicit rule for
commands.
! $(UTILS) : $(UTILS_INTDIR) $(BINDIR) libxml libxmla
libxmladll
# Source dependences should be autogenerated somehow here,
but how to
# do it? I have no clue.
***************
*** 377,385 ****
del result.%%~nxI result2.%%~nxI\
) \
)
-
-
-
-
-
-
--- 442,444 ----
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome.org
http://mai
l.gnome.org/mailman/listinfo/xml
|
|
[1-5]
|
|