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

Last reviewed: April 25, 1997
Article 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


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 25, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.