I'm trying to create an extension dll that references a database via ADO, using VC 6. The problem comes when the application is exited and it spits up the following error:
'Unhandled exception in <application> (MSDART.DLL) 0xC0000005: Access Violation'
Currently the connection object is a global, to an exported class that I'm using as a layer between the application and the database. This object is created, opened, (no transactions are run against it yet) then closed, detached and finally set to null, which should destroy it. In addition ::CoInitialize and ::CoUninitialize are called in the constructor and destructor of this class.
The call stack doesn't list my application, but does list ~com_ptr_t(), which I am assuming would be a COM destructor? So is the OS trying to access the object that was in my dll? If so why/how do I get around it?
Any help or pointers would be greatly appreciated.
April 15th, 2003, 02:58 PM
I'm experiencing the same error.
When I run the exact same code in a EXE as compared to inside a DLL it works fine with no exit problems.
I get the exception on the Rlease function.
if (m_nEditStatus != dbEditNone)
TRACE("Caught unknown error in CADORecordset::Close()\n");
m_pRecordset = NULL;
m_pRecBinding = NULL;
m_strQuery = _T("");
m_csLastError = _T("");
m_dwLastError = 0;
m_nEditStatus = dbEditNone;
TRACE("Caught unknown error in ~CADORecordset.\n");
Using the try/catch loop I'm able to get past the error for the moment, but I'm unclear as to why it's happening or yet how to really fix it. Please let me know if you find a solution...
I've been searching the Microsoft databases but haven't had much luck at finding any information on the ADO/DLL problem.
The version of the MSDART.DLL I'm running is is version 2.71.9030.0, when I looked up the DLL on Microsft's site they said the latest was 2.71.9031.4. Are you running the same one?
What version of the MDAC do you have installed? I believe I'm running the 2.7 SP1(WinXP) version though mdac component checker, doesn't completely see DLL's correctly, all the registy entries and com details appear fine as well as the ODBC and OLEDB entries.
I did find, Microsoft Knowledge base article 272373..
Access Violation occurs when closing ADO recordsets in multithreaded applications. It talks about a high stress on a mulipleprocessor computer. I don't have that, but the dll I wrote is under high stress as thousands of callbacks a second maybe happening. It said the problem should have been corrected in 2.7 MDAC, so the article was all that useful..
I've tried adding a sleep call to slow down the destruction, and even tried writing a function call to shut down early before the normal destruction..
April 15th, 2003, 04:58 PM
Please use code tags when posting code so we can all read it.
October 7th, 2003, 07:33 AM
unhandled exception (MSDARD.DLL)
Hi Abomination ! First sorry for my English.
I have met same problem (exception from msdart.dll)!
Have you solved the problem ?
If YES, please tell me how.
I try to explain my situation :
I made an DLL and I created a few functions:
At top of file source (cpp) I declarated :
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF", "EndOfFile")
pRS is visible in all file .
An example for function's declaration :
void _declspec (dllexport) Func1(args)
In an function I open a table using pRS.
I'm assure to catch any exception and close pRS.
When I exit from aplication , I see following error:
'Unhandled exception in <application> (MSDART.DLL)
Thank you in advance !