Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Access Violation 0xc0000005

Posted on 2004-10-05
4
Medium Priority
?
245 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

730 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