C# calling C++ error (instruction at referenced memory could not be read)

G

gwell

Hi,

I have a C# assembly that is calling directly into C++ unmanaged
code. Everything is working fine but at the very end of the process I
get an application error, which says:

"The instruction at (hexNumber) referenced memory at (hexNumber). The
memory could not be read. Click on OK to terminate the program."

It seems to me that the .Net CLR is trying to unload the C++ dll but
hits an issue when it tries to free up some resources. I have read
that this can sometimes occur if there is a buffer overflow. For
example, if you pass in a string or array (by ref) and the C++ code
overruns the array. However, I am not sure if this is my problem.

I am passing in a number of "ref" params into the C++ function, these
are all arrays. I am passing in strings but these are "by value". I
have checked all the values going in and coming out and they all look
the exact same.

Any ideas on his would be greatly appreciated..

Thanks!
gwell
 
R

red floyd

gwell said:
Hi,

I have a C# assembly that is calling directly into C++ unmanaged
code. Everything is working fine but at the very end of the process I
get an application error, which says:

"The instruction at (hexNumber) referenced memory at (hexNumber). The
memory could not be read. Click on OK to terminate the program."

It seems to me that the .Net CLR is trying to unload the C++ dll but
hits an issue when it tries to free up some resources. I have read
that this can sometimes occur if there is a buffer overflow. For
example, if you pass in a string or array (by ref) and the C++ code
overruns the array. However, I am not sure if this is my problem.

I am passing in a number of "ref" params into the C++ function, these
are all arrays. I am passing in strings but these are "by value". I
have checked all the values going in and coming out and they all look
the exact same.

Any ideas on his would be greatly appreciated..

I'm sorry, but your question is not topical in comp.lang.c++. The
issues you ask are not addressed by ISO/IEC 14882 (either the 1998 or
2003 versions).

Please try a newsgroup with "Microsoft", "Windows", or "dotnet" in the name.

FAQ 5.9 may give you some suggestions.
 
G

gwell

I'm sorry, but your question is not topical in comp.lang.c++. The
issues you ask are not addressed by ISO/IEC 14882 (either the 1998 or
2003 versions).

Please try a newsgroup with "Microsoft", "Windows", or "dotnet" in the name.

FAQ 5.9 may give you some suggestions.- Hide quoted text -

- Show quoted text -

Hi.. sorry about that... I've posted on the C# forum so hopefully I
might get some help over there. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top