> Error Message : Unhandled exception at 0x0008686a in export.exe: 0xC0000005:
> Access violation reading location 0x0008686a.
Here are some possible reasons:
1) Buffer overwrite in a function (thus jumping to incorrect address when returning;
check arrays declared as local variables and make sure that the code does not write
past their boundaries)
2) Function call through an invalid pointer
3) Heap corruption
4) Some other reasons are possible, but less likely
> what should be the approach to find out the error
Try to step through the code in the debugger, it is very likely
that you will find the problem this way. If you attached the debugger
only after the exception, check the call stack - it can tell what functions
were called recently (though it is possible that the call stack will not be available).
Also, since you write the code, use tracing and insert as many trace statements
into the application and the DLL as possible (at least, trace all function calls).
The trace log will tell you what functions have been executing just before
the problem occurred, therefore you will know where to look for the problem.
You can use OutputDebugString, TRACE, ATLTRACE, or other tracing libraries
(e.g. see CodeGuru.com).
Check that all DLL functions are properly declared, and the declarations
are up-to-date in the DLL and in the client application.
Make sure that the up-to-date version of the DLL is used
(check the location it is loaded from).
If you use VS.NET, make sure that /RTC1 and /GS compiler options are enabled.
If you call functions through pointers, verify all pointers before calling the functions.
If it does not help, there are other approaches that can be applied.
Regards,
Oleg