2 How to compile Erlang ODBC on Windows
This chapter shows how to compile the C code in Erlang ODBC application on Windows. The C code is compiled for Windows but if you need to recompiled it, may you read this chapter.
To be able to compile the Erlang ODBC application on Windows the following are required:
- Erlang
- Visual C++ version 5.0 or higher
- ODBC drivers for your database
2.1 C Compiler on Windows
The C code in Erlang ODBC application should be compiled with Visual C++ version 5.0 or higher. Visual C++ require certain environment variables to be set properly. These includes PATH which point to
\bin
subdirectory of your Visual C++ installation, LIB which point to\lib
and INCLUDE point to\include
.
When you install Visual C++, the setup creates a file VCVARS32.BAT, containing commands for modifying the PATH, LIB and INCLUDE environment variables. If these variables have not been set properly, run VCVARS32.BAT, located in the \bin subdirectory, before you compile at the command prompt.2.2 Configuring the Erlang ODBC application
After installing Erlang, the Erlang ODBC application source code is located in the
<OTPROOT>\lib\odbc-<odbcversion>\src
subdirectory. <OTPROOT> is normally the path"C:\Program Files\erl<erlang version>"
. In the subdirectory is a Makefile containing path to the ODBC import library and paths to the header files used by the Erlang ODBC application. These paths must be set properly.2.3 Configuring Makefile
Erlang ODBC application requires ODBC import library (ODBC32.LIB) and header files. The Visual C++ \lib subdirectory contains the import library and \include the header files. The path to the library and include files is set by the batch file VCVARS32.BAT.
The Erlang ODBC application uses the Erl_interface header files and lib file. The variable EIROOT defines the path to the Erl_Interface application, e.g.$(OTPROOT)\lib\erl_interface-3.3.0
. EIROOT must point to the version of Erl_Interface you intend to use, e.g., you might have to change the subdirectoryerl_interface-3.3.0
to represent a later version.2.4 Compile ODBC
- Start command prompt.
- Change to the \bin subdirectory of your Visual C++ installation.
- Run VCVARS32.BAT by typing VCVARS32.
- Change to
<OTPROOT>\lib\odbc-<odbcversion>\src
subdirectory.
- Compile ODBC by typing
nmake
.