Hi,
I'm getting an crash that I can't fix. The crash concerns MTXDM.DLL.
I've got this since I used Includes and split my code into 2 dlls.
The includes are used by DLL1 to use the functions from DLL2.
Each DLL is using a Critical Section which is dimmed, initialized in the LibMain (process attach) and deleted (process detach).
For the rest, it enters and leaves the CS when accessing my global arrays (used by both DLL, loaded only once).
I've tested it and found - strangly - that the CS from DLL2 is initialised first while the one from DLL1 is initialised after that one. Apparently the include triggers the second DLL first.
I got this problem with a VB app, calling (PB) DLL1. So I wrote a little PB exe that does nothing more than call the DLL1 (see code below). All goes well, the code is running, entering and leaving the CS's and finishes. It provides the result and should finish. I declared DLL1 (no dynamic loading) so I don't do any freelibrary.
When it should finish, it provides this error. I put messageboxes in the LibMain Process Attach and Detach, so I was expecting the Process Detach message boxes (where the CS is deleted). Didn't get them... Just the error.
I do use some dynamic loading of different DLL, but I checked if they where unloaded: all ok. What am I doing wrong here?
I found in the MSDN that this dll is for database connection and that this problem occurs when connecting and disconnecting to a database a lot. I use two connections to a database by means of SQL Tools but I only open them once. I even uninstalled MS PWS that was still on my system and reinstalled MDAC_TYPE.
I don't really see how this is affected by the use of critical sections or includes. I've checked everything I know.
Hope someone can help.
Jeroen
The code of the exe:
------------------
I'm getting an crash that I can't fix. The crash concerns MTXDM.DLL.
I've got this since I used Includes and split my code into 2 dlls.
The includes are used by DLL1 to use the functions from DLL2.
Each DLL is using a Critical Section which is dimmed, initialized in the LibMain (process attach) and deleted (process detach).
For the rest, it enters and leaves the CS when accessing my global arrays (used by both DLL, loaded only once).
I've tested it and found - strangly - that the CS from DLL2 is initialised first while the one from DLL1 is initialised after that one. Apparently the include triggers the second DLL first.
I got this problem with a VB app, calling (PB) DLL1. So I wrote a little PB exe that does nothing more than call the DLL1 (see code below). All goes well, the code is running, entering and leaving the CS's and finishes. It provides the result and should finish. I declared DLL1 (no dynamic loading) so I don't do any freelibrary.
When it should finish, it provides this error. I put messageboxes in the LibMain Process Attach and Detach, so I was expecting the Process Detach message boxes (where the CS is deleted). Didn't get them... Just the error.
I do use some dynamic loading of different DLL, but I checked if they where unloaded: all ok. What am I doing wrong here?
I found in the MSDN that this dll is for database connection and that this problem occurs when connecting and disconnecting to a database a lot. I use two connections to a database by means of SQL Tools but I only open them once. I even uninstalled MS PWS that was still on my system and reinstalled MDAC_TYPE.
I don't really see how this is affected by the use of critical sections or includes. I've checked everything I know.
Hope someone can help.
Jeroen
The code of the exe:
Code:
DECLARE FUNCTION TestFunction LIB "MyDLL.dll" ALIAS "TESTFUNCTION" (BYREF ComSession AS ComInfo) AS LONG ' COMINFO = one of my UDT FUNCTION PBMAIN() AS LONG LOCAL Com AS COMInfo Com.UserInput = "testinput to trigger: 15ma99" Com.Root = "C:\PBDLL\Test1" result& = Component_RO(Com) MSGBOX "result = " + TRIM$(Com.OutputString) ' this is still displayed END FUNCTION LibMain of DLL1 (same for DLl2 but with GSC2) FUNCTION LIBMAIN(BYVAL hInstance AS LONG, _ BYVAL fwdReason AS LONG, _ BYVAL lpvReserved AS LONG) EXPORT AS LONG ON ERROR RESUME NEXT SELECT CASE fwdReason CASE %DLL_PROCESS_ATTACH DIM GSC2 AS GLOBAL Critical_Section InitializeCriticalSection GSC2 MSGBOX "GSC2 INI" LIBMAIN = 1 'success! EXIT FUNCTION CASE %DLL_PROCESS_DETACH DeleteCriticalSection GSC2 MSGBOX "GSC2 Deleted" LIBMAIN = 1 'success! EXIT FUNCTION END SELECT END FUNCTION
------------------
Comment