struct Data { int depth; } extern (C) void startElement(void* userData, const(char)* name, const(char*)* atts) nothrow { Data user_data = (*cast(Data*) userData); user_data.depth++; // and so forth
I do not know if this is the right way to do it but it seems to work.