Solved

Access Violation 0xc0000005

Posted on 2004-10-05
4
232 Views
Last Modified: 2010-04-01
I have a small console EXE and DLL, both compiled with the single-threaded debug version of the runtime library. All classes in the DLL are exported and I link to the import library in the EXE. However, I get an application failed to initialize error (0xc0000005) when trying to run the EXE in the IDE or from the command line and the program fails to run. I know it's probably something simple I'm doing wrong or missing, but how do I get around this so I can see that my EXE is actually using the DLL? Thanks.
0
Comment
Question by:davev
4 Comments
 
LVL 8

Expert Comment

by:mxjijo
ID: 12232949

run in debug mode (F5). It will stop at the point where it crashes
0
 

Expert Comment

by:Scobar
ID: 12246328
Try checking that your dll exports the correct functions, etc using a program like Dependency Walker.
http://www.dependencywalker.com/ 

Open your .exe program with this and check the functions against your .DLL.
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 50 total points
ID: 12248727
Set a breakpoint to the begin of the executable. When stopped at break point open menu Debug - Exceptions ... . Locate "access violation" in the exception list below, hilite it and check "Stop Always" radio button. Then run the prog to the crash.

When stopped in Debugger, check the Call Stack Window (if not already shown, right-click to an empty spot somewhere in the menu area of Visual Studio and check "Call Stack"). Check call hierarchy top down til you see any function you've written. Open source and you spotted the line of your code that caused the crash. "Access violation" most likely is a call to a NULL pointer, an uninitialized pointer or a pointer already deleted. It could also be a strcpy or a memcpy where the destination buffer is less than the sopurce buffer. When calling a DLL you couldn't delete a pointer created in the DLL and viceversa. Both might lead to an access violation.

Regards, Alex
 
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question