Instructions for building SrPersist
-----------------------------------
Because SrPersist can be used with any ODBC driver manager, we do not
supply it in compiled form. You'll need to edit the supplied Makefile
(Unix), srpersist.mak (Windows), or srpersist.mac-make (Macintosh) as
described below.
Once you have built SrPersist, look in plt/collects/srpersist/doc.txt
for information on how to load and run the extension.
Header files
------------
SrPersist relies on definitions in ODBC C header files supplied by
Microsoft, or by vendors of ODBC Driver Managers. Since those files are
copyrighted, PLT cannot distribute them.
If you are using Microsoft Visual C++ or Visual Studio .NET to compile
SrPersist, the necessary files are downloadable from the Web. You'll need
to download the Microsoft Data Access Components (MDAC), available at
http://www.microsoft.com/data/. We used version 2.6; we expect later
versions will work. After downloading MDAC, copy the files sql.h, sqlext.h,
sqltypes.h, and sqlucode.h to this directory, plt/src/srpersist/.
For other platforms, the Driver Manager library you choose should provide
ODBC header files with similar names.
Windows compilation
-------------------
You'll probably need Visual C++ 6.0 or Visual Studio .NET installed,
although other versions may work.
Most likely, you'll be using the Microsoft ODBC driver manager. In that
case, you can run
nmake /f srpersist.mak
nmake install /f srpersist.mak
If you want to link to another driver manager, you may need to change
the variable ODBCVER to indicate the ODBC version supported by that
manager, and you will need to change ODBC_LIBS to indicate the
libraries that implement the manager. ODBC versions are indicated
using C-style hexadecimal numbers. Thus, ODBC 1.0 is indicated by
0x0100, ODBC 2.0 is 0x0200, ODBC 3.5 is 0x0350, and so on.
Unix compilation
----------------
For Unix, unlike Windows, there is no standard driver manager.
Therefore, you will definitely need to modify the Makefile
in order to compile SrPersist. Change DRIVER_MGR_LIB to the
name of the static library that implements the driver manager
you wish to use. By convention, Unix static libraries are named
lib<name>.a. So if the library file is libdrivermanager.a, you
would have
DRIVER_MGR_LIB=drivermanager
in the Makefile. You need to set the variable ODBCVER to the version of
ODBC supported by your driver manager. ODBC versions are indicated using
C-style hexadecimal numbers. Thus, ODBC 1.0 is indicated by 0x0100, ODBC
2.0 is 0x0200, ODBC 3.5 is 0x0350, and so on. To compile for ODBC 2.0, for
instance, you'd have
ODBCVER=0x0200
in the Makefile. The variable INCDIR should specify the directory
containing the driver manager's include files. The variable
LIBDIR specifies the directory containing the driver manager's
library files. You should remove the definitions for HAVE_CHAR,
HAVE_LPWSTR, and HAVE_WCHAR if your driver manager include files do
not have type definitions for CHAR, WCHAR, and LPWSTR; add a definition
for NO_SQLUCODE if your driver manager does not have the include file
SQLUCODE.H.
If you're using gcc 3.2 (and, probably, newer versions), you'll
need to
- set the variable STDCPP_LIBDIR to the variable containing
the library libstdc++.a, and
- uncomment the specified line for the srpmain.so target
Otherwise, if you do not make these changes, when you load SrPersist,
you'll get a message about a missing reference to `gxx_personality_v0'.
Once you've made these changes, you can compile everything by
running
make
make install
Macintosh compilation
---------------------
Compilation for Mac Classic is no longer supported. For Mac OS X,
follow the directions for Unix compilation.