INF: Using DB-Library with Visual C++

Last reviewed: April 28, 1997
Article ID: Q104716

The information in this article applies to:

  - Microsoft SQL Server Programmer's Toolkit, version 4.2

SUMMARY

Using DB-Library for MS-DOS, Windows, and Windows NT with Visual C++ and Visual C++ for Windows NT requires a few steps to configure correctly.

MORE INFORMATION

Follow these steps to create a Visual C++ project for a DB-Library application:

  1. From the Options menu, choose Directories. Include the directory where the DB-Library .H header files are located (C:\SQL\DBLIB\INCLUDE by default) in the Include Files Path box. Include the directory where the DB-Library .LIB library files are located (C:\SQL\DBLIB\LIB by default) in the Library Files Path box.

  2. Select the Project menu and choose New. Choose an appropriate Project Name, using the Browse button to specify the directory where the application's C/C++ source code files reside. Choose the appropriate Project Type from the list box:

    a. For Windows, select Windows application (.EXE) or Windows

          dynamic-link library (.DLL)
    

    b. For Windows NT, select Windows application (.EXE), Console

          application (.EXE), or Dynamic-link library (.DLL)
    

    c. For MS-DOS, select MS-DOS application (.EXE)

  3. In the File Name box of the project Edit dialog box, type the directory (C:\SQL\DBLIB\LIB by default) and file name of the appropriate DB-Library .LIB library file:

    a. For Windows, use W3DBLIB.LIB

    b. For Windows NT, use NTWDBLIB.LIB

    c. For medium model MS-DOS, use RMDBLIB.LIB

    d. For large model MS-DOS, use RLDBLIB.LIB

    then use the Add button to include the file in the project. Ensure that the appropriate .LIB file is now listed in the Files in Project list box.

  4. Include the C/C++ application's source code files in the project.

  5. For MS-DOS, select the Options menu and choose Project. Choose the Compiler button. Select the Common to Both radio button. From the Category list box, choose Memory Model, then select the appropriate memory model from the Model drop down list box:

    a. For medium model MS-DOS, select Medium

    b. For large model MS-DOS, select Large

  6. For Windows, select the Options menu and choose Project. Choose the Compiler button. From the Category list box, choose Windows Prolog/Epilog, and note that Protected Mode Application Functions (/GA for applications, /GD for DLLs) is the default.

    To use this compiler option, the application's DB-Library error and message handlers must be declared using the Visual C++ '__export' keyword. Failure to do can result in a general protection fault (GP fault) inside the application's DB-Library error or message handler.


Additional query words: dblib
Keywords : kbprg SSrvDB_Lib
Version : 4.2.5 | 4.2
Platform : MS-DOS WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: April 28, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.