Accessing Blender's DNA Mesh struct via as_pointer() How can I access the actual structure of a Mesh datablock in memory using the value returned from bpy.types.Mesh.as_pointer() In 2.79 Blender there used to be a possibility to do that by just passing the pointer value to your C++ module or Python's ctypes and referencing that pointer with an appropriate type. 
Example for 2.7 can be seen here: 
https://blenderartists.org/t/exporting-triangles-api-challenges/694524/2

However, when I access it the same way in 2.8, I get a struct which is 0-ed. It does contain a valid ID sub-struct in it, but the rest of the data is nulled. Could that be the issue brought by the new depsgraph in 2.8?

C++ side:

#include "mesh_utils.hpp"

extern "C"
{
    #include "bl_src/makesdna/DNA_mesh_types.h"
    #include &lt;blenkernel/BKE_editmesh.h&gt;
    #include &lt;bmesh.h&gt;
}

#include &lt;iostream&gt;

namespace bpy_boost
{

BlenderMesh::BlenderMesh(::std::uintptr_t mesh_pointer)
{
    const Mesh* mesh = reinterpret_cast&lt;const Mesh*&gt;(mesh_pointer);

    ::std::cout &lt;&lt; (uint32_t)mesh-&gt;totloop &lt;&lt; ::std::endl;
}



}


Python side:

def execute(self, context):

        from ..bpy_boost.src.bpy_boost import Mesh

        ds = bpy.context.evaluated_depsgraph_get()
        obj = bpy.context.view_layer.objects.active

        object_eval = obj.evaluated_get(ds)
        if object_eval:
            mesh = object_eval.to_mesh()

            if mesh: 
                mesh.calc_loop_triangles()
                if not mesh.loop_triangles:
                    object_eval.to_mesh_clear()
                    mesh = None

            if mesh:
                if mesh.use_auto_smooth:
                    if not mesh.has_custom_normals:
                        mesh.calc_normals()
                    mesh.split_faces()

                mesh.calc_loop_triangles()

                if mesh.has_custom_normals:
                    mesh.calc_normals_split()

            ptr = mesh.as_pointer()

            Mesh(ptr)

        return {'FINISHED'}


The validity of the pointer value between Python and C++ has been checked. Python-C++ interface is done with Cython and is not provided here since it is not important.
I managed to figure this issue out. It made a mistake using a Mesh structure from 2.9 Blender sources instead of 2.82 which is the Blender build I am running this code on. The mesh.as_pointer() does give a valid pointer to the DNA Mesh struct right away.