Compiling and Linking for MS-DOS

Embedded SQL for C and SQL Server

Embedded SQL for C and SQL Server

Compiling and Linking for MS-DOS

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

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

ESQL/C sources can be built as large memory model MS-DOS 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 MS-DOS:

  • Car.lib

  • Rldblib.lib

  • Sqlakd.lib

To compile and link a program for MS-DOS

  1. Run the compiler Cl.exe as you would for MS-DOS 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 MS-DOS to link the compiled ESQL/C object file and system libraries, which creates an executable file for MS-DOS. When linking files for MS-DOS-based programs, you must explicitly link with the Sqlakd.lib, Rldblib.lib, Oldnames.lib and Car.lib libraries, for example:

    In the example, the compiled object file Myprogrm.obj, system library Llibce.lib, ESQL/C libraries Sqlakd.lib, Car.lib, and Oldnames.lib and the DB-Library library Rldblib.lib are linked together to create the executable file Myprogrm.exe for MS-DOS.

To run an MS-DOS-based ESQL/C application, load the appropriate Net-Library TSR.