Solved

while calling a C++ COM empty function,getting error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.""

Posted on 2013-06-19
6
407 Views
Last Modified: 2013-06-23
Hello All

While calling a C++ COM empty function,getting error "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.""

Please help.
0
Comment
Question by:BYTECHINDIA
[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
  • 2
  • 2
  • 2
6 Comments
 
LVL 16

Assisted Solution

by:George Tokas
George Tokas earned 333 total points
ID: 39261254
Most likely the COM object is not created and you are calling a member function on a non-initialized component...
Try adding a breakpoint at the line raizing the exception and examine the components handler...
This message looks like from managed code so you will see a description "no valid...(something)" or something similar...

George Tokas.
0
 

Author Comment

by:BYTECHINDIA
ID: 39262037
Now when we have changed the location to other server and run the application in c# which is basically calling c++COM DLL empty function,getting error "Exception from HRESULT: 0xC0000005 ",no other detail is coming.I am not able to find out that whether this is from C# code or from c++ DLL.
0
 
LVL 16

Assisted Solution

by:George Tokas
George Tokas earned 333 total points
ID: 39262084
0xC0000005 is access violation code caused from what I described earlier but also an attempt to call a method on a released object...
Exception from HRESULT means that it is something like that:
HRESULT hr = NULL;
hr = functionfromdll();
functionfromdll() is calling a method or function on a NON existent component, it is not just an empty com function...
That means that the dll has to export a creation (new instance of the component) somehow...
In a very few words you are missing a function call needed to create and init the com object...

George Tokas.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 34

Accepted Solution

by:
sarabande earned 167 total points
ID: 39262145
what do you mean by 'COM empty function'?

generally, the error you reported is when using a com pointer that is not valid, or that is not fully initialized, or that was no more valid because of an unsuccessful call before. normally you can avoid those errors by always verifying com objects before use.

Sara
0
 
LVL 34

Expert Comment

by:sarabande
ID: 39262265
access violation is pointer error. so it is more likely to happen in c++ dll.

can you run the program in debug mode from visual studio ide?

Sara
0
 

Author Closing Comment

by:BYTECHINDIA
ID: 39269648
Thanks to all..
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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

617 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