Compiling and Linking for 16-bit Windows

Embedded SQL for C and SQL Server

Embedded SQL for C and SQL Server

Compiling and Linking for 16-bit Windows

Microsoft® SQL Server™ 2000 does not supply the environment for compiling ESQL/C 16-bit Microsoft Windows® clients (the 16-bit binaries for Windows are not included). However, these clients will run under SQL Server 2000. To compile an ESQL/C 16-bit Windows client, you need to use the ESQL/C compilation environment in SQL Server 6.0 or 6.5, which includes the 16-bit Windows binaries.

You can compile and link precompiled ESQL/C programs for 16-bit Windows on a computer running the Microsoft MS-DOS® or 16-bit Windows operating system by using the Microsoft Visual C++® development system (16-bit), version 1.52 or later.

ESQL/C source files can be built as either large or medium memory model 16-bit Windows executable files.

You can set the LIB environment variable to avoid specifying library paths for the ESQL/C libraries, for example:

SET LIB= C:\Program Files\Microsoft SQL Server\80\Tools\DevTools\Lib;C:\MSVC\LIB

The following libraries are supplied and used by ESQL/C programs when built for 16-bit Windows:

  • Caw.lib

  • Sqlakw.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 /AL MYPROGRM.C
    

    In the example, the compiler creates the object file Myprogrm.obj. The /AL compiler option sets the memory model of the program to large. You can use any additional compiler options allowed by the compiler.

  2. Run the linker Link.exe as you would for 16-bit Windows to link the compiled ESQL/C object file and system libraries, which 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 LLIBCEW.LIB SQLAKW.LIB CAW.LIB,
    MYPROGRM.DEF;
    

    In the example, the compiled object file Myprogrm.obj, system libraries Libw.lib and Mlibcew.lib, and ESQL/C libraries Sqlakw.lib and Caw.lib are linked together to create the large model, executable file Myprogrm.exe for Windows.

To run a 16-bit Windows-based ESQL/C application, the dynamic-link libraries Sqlakw.dll, Msdblib3.dll, and Dbnmp3.dll (or other appropriate Net-Library) must be available in your path.