How do I setup my build environment to build XML4C applications?
For Windows NT/95/98
In order to build applications using XML4C, you will need to set the following
items in your build environment. You will need to use the mechanisms that your development environment provides for specifying these values. The mechanisms for Microsoft Visual C++ are described below.
Note: The Microsoft Visual C++ project files for building the sample programs that are included with the distribution of XML4C already include the necessary settings. So you don't need to change anything unless you are
doing something special
Add the directory <full_path_to_xml4c2_1_0>\include to your include file search path (use the "Project/Settings: C/C++->Preprocessor->Additional Include
Directories" setting in MSVC, or set the INCLUDE environment variable on the command line).
Add the directory <full_path_to_xml4c2_1_0>\lib to your library path (use the
"Link->Input->Additional Library Path" setting in MSVC, or set the LIB environment variable on the command line).
The C preprocessor variables must be defined in the environment to make the
headers do the right kind of build, controlling the development environment and the character mode. These are set from within MSVC using the "Project/Settings: C/C++->General->Preprocessor Definitions"
. Under Win98/95, the best setting would be _MBCS or _SBCS, but NT's native format is Unicode so _UNICODE would provide the optimum performance on that platform.
You must use the DLL version of the C/C++ runtime library. In MSVC pick "Multithreaded DLL" for your release builds and
"Debug Multithreaded DLL" for your debug builds. This is done in the "Project/Settings: C/C++->Code
Generation->Use Runtime Library" setting.
Add the XML4C import library as import libraries for your project. This is named IXXML4C2.lib for this release, and should be set in the "Project/Settings: Link->General->Object/library Modules" setting in MSVC.
For AIX and Solaris
XML4C has been tested on AIX 4.1.4 and Solaris 2.6. In order to build
applications using XML4C, you may need to write a Makefile for convenience.
The following steps gives a detailed instruction for building and running your application:
Have the compiler set in your PATH variable. For example, export
PATH=$PATH:/usr/bin/xlC_r/bin (where xlC_r is the compiler used)
Have your application in any desired directory or for convenience can have it under <full_path_to_xml4c2_1_0>/samples/<applnname> directory.
Copy a makefile from a sample, say
<full_path_to_xml4c2_1_0>/samples/Projects/AIX directory .
Set the environment variable ROOTDIR as <full_path_to_xml4c2_1_0>.
For example,
export PATH=$PATH:<full_path_to_xml4c2_1_0>/bin (if korn shell)
setenv PATH $PATH:<full_path_to_xml4c2_1_0>/bin (if c shell)
The makefiles shipped with XML4C use the ROOTDIR environment variable. These makefiles can be found in the samples/Projects/AIX
directory.
Set the library path variable in the environment as
<full_path_to_xml4c2_1_0>/lib:/usr/lib.
Libraries under <full_path_to_intlFiles directory>/lib
are Shared libraries and libraries under <full_path_to_xml4c2_1_0>/lib directory are static libraries.
Check the directory for internationalization converter files (.cnv files). The most obvious place where you'll find the converter files is <full_path_to_xml4c2_1_0>/lib/intlFiles/locales. If the converter files are NOT in this directory, then you need to set an environment variable XML4C2INTLDIR giving the proper directory name where the files reside.
For example,
export XML4C2INTLDIR=<full_path_to_intlFiles> (if korn shell)
setenv XML4C2INTLDIR <full_path_to_intlFiles> (if c shell)
If you have the international converter files in <full_path_to_xml4c2_1_0>/lib/intlFiles/locales directory, then make sure you unset the XML4C2INTLDIR environment variable.This can be done by executing
unset XML4C2INTLDIR
The makefile needs to be updated with the application related information. This
can be done by updating the following things in the makefile
Edit the OUTDIR variable
<full_path_to_xml4c2_1_0>/bin/obj/<applnname> directory.
Edit the OBJS variable to create the application related object files. For example, for sample having foo1.cpp foo2.cpp edit
OBJS= ${OUTDIR}/foo1.o
${OUTDIR}/foo2.o
Edit the SRC
variable to point to the application source.
Under the 'makedir:' directive change the sample name to the appropriate
application name. This process creates the necessary directories prior to building the application.
Edit the executable name to the desired name. For example, for application having executable name as foo edit:
${EXEC}/foo : ${OBJS}
${LIB}/*.a (or .so on Solaris)
Make sure the library files are under <full_path_to_xml4c2_1_0>/lib
directory and it contains libIXXML4C2_1.a (or libIXXML4C2_1.so). Make sure the include files are under
<full_path_to_xml4c2_1_0>/include directory. Make sure the internationalization transcoding converter data files are under
<full_path_to_xml4c2_1_0>/lib/intlFiles/locales directory or where ever the XML4C2INTLDIR
is set by you.
Change the .o and .cpp files with the appropriate application filenames. For example
for the application having foo.cpp update as follows:
$(OUTDIR)/foo.o: ${SRC}/foo.cpp
xlC_r ${CMP} $(INCLUDES) -o$(OUTDIR)/foo.o ${SRC}/foo.cpp
Update the 'clean:' directive to clean the right application executable. For example, for
foo application executable modify as
clean:
rm -f ${OUTDIR}/*.o ${EXEC}/foo
After the Makefile is all set, run make as follows:
For an application makefile named foo.mak
make -f foo.mak COMPILESWITCH="-w -O" (for optimized builds)
make -f foo.mak COMPILESWITCH=-g (for debug builds)
To clean the build run as follows:
make clean -f foo.mak COMPILESWITCH="-w -O" (for optimized builds)
make clean -f foo.mak COMPILESWITCH=-g (for debug builds).