Click here to Skip to main content
15,895,799 members

How to debug into a dll written in Native C++ Used in C#

Keanu L asked:

Open original thread
i am writting a program using Native C++ as dll , C++ CLI as a wrapper and C# for the UI. When I build it in Debug mode, it works fine , but in Release mode it throws an Access Exception. what's worse , when i debug it from C# code,i could not debug into the CLI code,much less the Native C++ DLL Code. But the exception throwed by the program showed that the error exists in the dll, i could not debug into it . Any help?

The exception may be produced like this:
In C# , i press button A, and then in Native C++ DLL , there is a class A uses malloc to allocate the memory and class B has an array of 256 chars and Class A will dynamic allocate the memory for creating a dynamic link list. The first time always works fine,after press button B,class A and Class B is deleted with out any problem. when i press Button A again.,The class A and Class B is created using new operator with out any problem, But when i access the char array in Class B, the program throws out the exception. If i commented dynamic link list code in class A , the exception gone. so i think the problem comes from the memory allocated . but , i could not debug into it.

Any help
Tags: C++ (C++/CLI), C#

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900