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
396 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
  • 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
Industry Leaders: 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

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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 use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

713 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