INF: Using DB-Library with Visual C++

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:

    1. For Windows, select Windows application (.EXE) or Windows dynamic-link library (.DLL)


    2. For Windows NT, select Windows application (.EXE), Console application (.EXE), or Dynamic-link library (.DLL)


    3. 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:

    1. For Windows, use W3DBLIB.LIB


    2. For Windows NT, use NTWDBLIB.LIB


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


    4. 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:

    1. For medium model MS-DOS, select Medium


    2. 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
Issue type :


Last Reviewed: March 17, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.