You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Randall Parker <ad...@futurepundit.com> on 2005/07/06 03:19:40 UTC
Build statically linkable lib for Borland compiler?
I want to build a static version of Xerces v2.6.0 for Borland v6 sp4. I
would just as soon avoid using the Borland IDE to do the build as that
brings in additional complexity.
Can anyone provide any hints for how to make a modified version of the
existing mak file?
Or how else to easily get it done? Maybe run a lib utility on the
directory of obj files that the build of the dynamic link library creates?
Since the static lib is of course NOT a dll I want to avoid linking in
DllMain. I see DllMain in two files:
File src\xercesc\com\xml4com.cpp:
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
if (!PrxDllMain(hInstance, dwReason, lpReserved))
File src\xercesc\util\MsgLoaders\Win32\Win32MsgLoader.cpp:
BOOL APIENTRY DllMain(HINSTANCE hModule,
BOOL APIENTRY DllMain(HINSTANCE hModule,
After running both the command line make file for making the dll and the
Borland project for making the dll I see that Win32MsgLoader does not
have an obj file in the output directories generated by the builds.
Also, xml4com does not have an obj file.
I also see DllEntryPoint in XercesLib.cpp here:
\xerces-c-src_2_6_0\Projects\Win32\BCC.551\Xerces-all\XercesLib\XercesLib.cpp
and that directory also has the XercesLib.mak that Xerces-all.mak includes.
That is where the DllEntryPoint is coming from, correct? If so, can I
just make a different XercesLib.mak? Would I have to remove the
XercesLib.cpp and .obj from it?
Here are parts of XercesLib.mak which has the big list of objs and the
XercesLib.cpp for the DllEntryPoint. Xerces-all.mak includes XercesLib.mak:
#
---------------------------------------------------------------------------
!if !$d(BCB)
BCB = $(MAKEDIR)\..
!endif
#
---------------------------------------------------------------------------
TARGETPATH=..\..\..\..\..\Build\Win32\BCC.551
PROJECT = $(TARGETPATH)\xerces-bor_$(XERCESVER).dll
!if $d(WITHDEPRDOM)
DEPRDOM_PATH=..\..\..\..\..\src\xercesc\dom\deprecated
DEPRDOM_DEFINE=;PROJ_DEPRECATED_DOM
DEPRDOM_OBJFILES = \
$(TARGETPATH)\obj\AttrImpl.obj
....
...
!endif
OBJFILES = $(TARGETPATH)\obj\XercesLib.obj \
$(TARGETPATH)\obj\Win32PlatformUtils.obj \
....
MAINSOURCE = XercesLib.cpp
Note the line above with the MAINSOURCE. Well, I don't really want one
of those I think. Then it also shows up in the OBJFILES list. Plus there
is the "PROJECT = " line that specifies the dll. Can I just shift that
to .lib and get a lib file out? I don't normally muck around at this
level and so I don't know my way around Borland make syntax or all the
stuff specific to Xerces.
Here is the first part of the Xerces-all.mak file. Can I leave it
unchanged if I just change my copy of XercesLib.mak?
#------------------------------------------------------------------------------
!ifndef ROOT
ROOT = $(MAKEDIR)\..
!endif
#------------------------------------------------------------------------------
MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
DCC = $(ROOT)\bin\dcc32.exe $**
BRCC = $(ROOT)\bin\brcc32.exe $**
#------------------------------------------------------------------------------
default: all
#------------------------------------------------------------------------------
# Rules for building from command prompt
MakeBuildDirs: MakeBuildDirs.bat
call $**
MAKEN = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f
PROJECTNAMES = XercesLib DOMCount DOMPrint SAXCount SAXPrint SAX2Count
SAX2Print \
DOMTest DOMMemTest DOMRangeTest DOMTraversal EncodingTest InitTermTest \
ThreadTest MemHandlerTest XSerializerTest PSVIWriter SCMPrint MemParse
Redirect \
StdInParse PParse EnumVal SEnumVal CreateDOMDocument XSValueTest
DeprecatedDOMCount \
DOMTypeInfoTest
!include ..\..\..\..\version.incl
XERCESVER=$(VER)
buildall: clearall $(PROJECTNAMES)
all: $(PROJECTNAMES)
clearall:
del /q ..\..\..\..\Build\Win32\BCC.551\*.*
..\..\..\..\Build\Win32\BCC.551\obj\*.*
XercesLib: XercesLib\XercesLib.mak
cd $<
$(MAKEN) $<.mak -DXERCESVER=$(XERCESVER) -DWITHDEPRDOM=$(WITHDEPRDOM)
-DWITHASM=$(WITHASM)
cd ..
DOMPrint: DOMPrint\DOMPrint.mak
cd $<
$(MAKEN) $<.mak -DXERCESVER=$(XERCESVER)
cd ..
and then a bunch of file actions are listed that I've cut out for brevity.
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org
Re: Build statically linkable lib for Borland compiler?
Posted by Vitaly Prapirny <ma...@mebius.net>.
Hi Randall,
Sorry for delay.
I'd successfully build static version of xerces 2.6.0 library
with this slightly modified XercesLib.mak, and tests and samples
executes reasonably well. This version use dynamic Borland runtime
library, so you have to modify this makefile even more if you want
to use static RTL.
Drop attached file to Projects\Win32\BCC.551\Xerces-all\XercesLib and
try.
I have no time to answer to every question in your message now, sorry.
Good luck !