Compiling and Linking for 16-bit Windows

You can compile and link precompiled Embedded SQL programs for 16-bit Windows on a computer that is running the MS-DOS or 16-bit Windows operating system by using the Visual C++ development system (16-bit) version 1.52 or later.

Before you compile an Embedded SQL program for 16-bit Windows, set the LIB environment variable to include the full path where the following library files are located:

For example:


SET LIB=C:\MSVC\LIB;C:\MSSQL\ESQL\LIB

To compile and link a program for 16-bit Windows

1. Run the compiler CL.EXE as you would for 16-bit Windows to create an object file. For example:


CL /c /W3 /AM MYPROGRM.C

In the example, the compiler creates the object file MYPROGRM.OBJ. The /AM compiler option sets the memory model of the program to medium. You can use any additional compiler options that are allowed by the compiler.

2. Run the linker LINK.EXE as you would for 16-bit Windows to link the compiled Embedded SQL object file and system libraries, which to creates an executable file for Windows. When linking files for Windows-based programs, you must explicitly link with the SQLAKW.LIB and CAW.LIB libraries. For example:


LINK /NOD MYPROGRM.OBJ,,, LIBW.LIB MLIBCEW.LIB SQLAKW.LIB CAW.LIB, MYPROGRM.DEF;

In the example, the compiled object file MYPROGRM.OBJ, the system libraries LIBW.LIB and MLIBCEW.LIB, and the Embedded SQL libraries SQLAKW.LIB and CAW.LIB are linked together to create the executable file MYPROGRM.EXE for Windows.

To run a 16-bit Windows–based Embedded SQL application, the dynamic-link libraries SQLAKW.DLL, MSDBLIB3.DLL, and DBNMP3.DLL (or other appropriate Net-Library) must be available in your path.