Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

C++/CLI pointers problem

$
0
0

Imagine I have ref class in C++/CLI project which I use in C# and this class contain c++ pointer

public ref class objekt { public:

objekt()

{

mObj = new cppObjekt*(nullptr);

}

// ... private: cppObjekt ** mObj; // this is must because I can't pass in CLI pointer for C++ method (cppObjekt *& ob) }


and I create mObj inside c++ dll code for example:

void create(cppObjekt *& ob)
{
    cppObjekt * o = new cppObjekt(/* ... */);
    ob = o;
    List.Add(o);
}

problem is, program sometimes crash.

I use wpf for GUI, and when I click add button object is created and everything is fine, but sometimes it crash, under debuger are unknow errros.

for example

  • Exception thrown at 0x0000000076FFF401 (ntdll.dll) in EFFB GUI.exe: 0xC0000005: Access violation reading location 0x0000000022106A10
  • ntdll.pdb contains the debug information required to find the source for the module ntdll.dll

or

  • Exception thrown at 0x000007FED79B90BD (wpfgfx_v0400.dll) in EFFB GUI.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
  • wpfgfx_v0400.pdb contains the debug information required to find the source for the module wpfgfx_v0400.dll

how can I pass pointer from C++/CLI in to C++ dll and hold data both on C++/CLI and dll side without crash?



Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>