Microsoft KB Archive/104716

{|
 * width="100%"|

INF: Using DB-Library with Visual C++

 * }

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:

 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</li> For Windows NT, use NTWDBLIB.LIB</li> For medium model MS-DOS, use RMDBLIB.LIB</li> For large model MS-DOS, use RLDBLIB.LIB</li></ol>

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.</li> Include the C/C++ application's source code files in the project.</li> 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</li> For large model MS-DOS, select Large</li></ol> </li> 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.</li></ol>

Additional query words: dblib

Keywords : kbprogramming

Issue type :

Technology : kbSQLServSearch kbAudDeveloper kbSQLServPTK420