Microsoft KB Archive/104716
INF: Using DB-Library with Visual C++
The information in this article applies to:
- Microsoft SQL Server Programmer's Toolkit, version 4.2
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.
Follow these steps to create a Visual C++ project for a DB-Library application:
- 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.
- 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:
- For Windows, select Windows application (.EXE) or Windows dynamic-link library (.DLL)
- For Windows NT, select Windows application (.EXE), Console application (.EXE), or Dynamic-link library (.DLL)
- For MS-DOS, select MS-DOS application (.EXE)
- 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:
- For Windows, use W3DBLIB.LIB
- For Windows NT, use NTWDBLIB.LIB
- For medium model MS-DOS, use RMDBLIB.LIB
- For large model MS-DOS, use RLDBLIB.LIB
- Include the C/C++ application's source code files in the project.
- 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:
- For medium model MS-DOS, select Medium
- For large model MS-DOS, select Large
- 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 : kbprogramming
Issue type :
Technology : kbSQLServSearch kbAudDeveloper kbSQLServPTK420
Last Reviewed: March 18, 1999