Click here to Skip to main content
15,435,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am on working on application on VS2008 MFC, where I am refering a third party lib file, which works fine on release build of my application.

the method signature which I called in my application in this way...


This method is their in the lib file. which works fine when I build in Release mode of my application. But when same code is called in debug mode I am getting error saying

"First-chance exception at 0x003a60e3 in My.exe: 0xC0000005: Access violation reading location 0x003a607e."

and My.exe exits.

can you share some info on this ...
Updated 19-Nov-12 19:28pm
Argonia 22-Nov-12 11:12am     CRLF
Ok first i work on Visual Studio 2010 so maybe the next i write isn't entirely true . First like i see it i think maybe you don't call the lib right and the method you call is trowing an exception. You can try to debug it with Disassembly window (if there is such thing in VS 2008) and see exactly where the error is thrown. Maybe you need to call some other function before this one. The other thing you can try i enable all Exceptions (Ctrl + Alt + E in VS 2010) to see if some variable initialization is going wrong or something like that . Good luck

1 solution

If your app uses libraries, make sure that you link to the same C runtime library (CRT)(e.g. if it uses Multithreaded DLL you too need to link the same CRT with your app). Otherwise, you will get access violation errors.

Since the 3rd party DLL must be a release build DLL, it must have been linked to release version of CRT. While, in debug build, your app will link to debug version of CRT. Ask the supplier of the DLL to provide you with a debug version of their library also. In debug build, you can link it to the debug version of their DLL.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900