• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 430
  • Last Modified:

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.""

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
BYTECHINDIA
Asked:
BYTECHINDIA
  • 2
  • 2
  • 2
3 Solutions
 
George TokasCommented:
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
 
BYTECHINDIAAuthor Commented:
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
 
George TokasCommented:
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!

 
sarabandeCommented:
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
 
sarabandeCommented:
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
 
BYTECHINDIAAuthor Commented:
Thanks to all..
0

Featured Post

Technology Partners: 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!

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now