PRSQL9105005: Problems When W3DBLIB.DLL Is Loaded at Run-Time

ID Number: Q72201

1.10

OS/2

buglist1.10

Summary:

PROBLEM ID: PRSQL9105005

SYMPTOM

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 when GetProcAddress() is called.

Functions declared with the C calling convention are case

sensitive. DB-LIBRARY (dblib) functions use the C calling

convention and are in all lowercase letters; therefore, Windows

cannot load these functions when they are referenced by name.

RESOLUTION

Pass the ordinal number of the dblib functions (assigned in the

.DEF file) to GetProcAddress(). For example:

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

The ordinal numbers of the dblib functions can be obtained by using

the EXEHDR program against W3DBLIB.DLL