PRB: Making DB-Library Calls in a User-Defined DLLLast reviewed: April 25, 1997Article ID: Q68184 |
The information in this article applies to:
SYMPTOMSA user-defined dynamic-link library (DLL) contains all DB-Library (DB-Lib) calls and also a global dbprocess() function. The first call to a DLL function opens a dbprocess() function. All subsequent calls to the DLL attempt to use the same dbprocess() function to communicate with SQL Server. When two processes run simultaneously, the first process to access the DLL opens the dbprocess() function and works correctly, while the second process fails when it calls a DLL function.
CAUSETwo processes cannot simultaneously share the same dbprocess() function because the DB-Library's data segment is reserved.
WORKAROUNDThere are at least three ways to achieve the same functionality:
MORE INFORMATIONYou cannot use a single dbprocess() function within a DLL for multiple .EXE files. DB-Library's data segment is reserved. This means that each process attached to PDBLIB.DLL (or W3DBLIB/WDBLIB) has its own private instance of a data segment. Therefore, one process never sees or accesses a dbprocess() function opened by a different process. If you define the dbprocess() function globally in the DLL, it is stored in the shared data area and any process attached to that DLL can see it. However, PDBLIB.DLL (or W3DBLIB.DLL/WDBLIB.DLL) defines dbprocess() functions locally, so these are stored in the private per-process data area. Therefore, another process cannot see the dbprocess() data that is initialized by another process. In OS/2 (that is, PDBLIB.DLL), only threads within the same process can access the same dbprocess() function opened by any one of them.
|
Additional query words: dblib
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |