something strange is happening to my code. I am using a library which is supposed to work perfectly (nglib from the open-source Netgen mesher). I can link and include everything, but I cannot use this library :
The object I want to use is Ng_Mesh* mesh = Ng_NewMesh ();
The Ng_NewMesh() method is :
DLL_HEADER Ng_Mesh * Ng_NewMesh ()
{
Mesh * mesh = new Mesh;
mesh->AddFaceDescriptor (FaceDescriptor (1, 1, 0, 1));
return (Ng_Mesh*) (void*) mesh;
}
When I go to locals, it is seen as a void** referring to *mesh which is a void*. It is not NULL because I can add points and other stuff to this object, but with some functions, I get an exception :
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.at
nglib.Ng_GetPoint(Void** , Int32 , Double* )
atForwardModelingPlugin.CustomMeshVol3D.tesselate(CustomMeshVol3D* )
nglib.Ng_GetPoint is supposed to have as arguments (Ng_Mesh*, Int32, Double*) which explains this exception.
I don’t know why this casting is happening.
Here it says:
therefore
Ng_Mesh* mesh;is the same asvoid** mesh;