PRB: Problems When W3DBLIB.DLL is Loaded at Run-Time

ID: Q72201


The information in this article applies to:
  • Microsoft SQL Server Programmer's Toolkit, version 4.2


SYMPTOMS

Attempting to load W3DBLIB.DLL at run-time in a program [by calling LOADLIBRARY()], and then attempting to get the address of a function by calling GetProcAddress(hLibrary, "<function_name>"), will return a NULL pointer.


CAUSE

Windows assumes that all procedures are defined with the PASCAL calling sequence; therefore, the application always looks for the function name to be in uppercase letters when GetProcAddress() is called. Functions declared with the C calling convention are case sensitive. DB-Library (DB-Lib) functions use the C calling convention and are in all lowercase letters; therefore, Windows cannot load these functions when they are referenced by name.


WORKAROUND

Pass the ordinal number of the db-lib functions (assigned in the .DEF file) to GetProcAddress(). For example:


   GetProcAddress(hLibrary,MAKESOURCE(43)); // dbinit 

The ordinal numbers of the DB-Lib functions can be obtained by using the EXEHDR program against W3DBLIB.DLL.


STATUS

Microsoft has confirmed this to be a problem in SQL Server version 4.2. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: Programming tools - windows dblib

Keywords : kbprg SSrvDB_Lib SSrvProg
Version : 4.2
Platform : WINDOWS
Issue type :


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