function gen_cpp_wrapaccessors(modname::String, typename::String, fieldinfos; indent::Int = 4) 
    indentstr = repeat(' ', indent)
    lines = [ "$modname.add_type<$typename>(\"$typename\")" ]
    for (T, V, n) in fieldinfos
        push!(lines, "$indentstr.method(\"$(typename)_get_$(n)\", [](const $(typename)& x) { return x.$(n); })")
        push!(lines, "$indentstr.method(\"$(typename)_set_$(n)\", []($(typename)& x, const $V v) { x.$(n) = v; })")
    end
    return join(lines, '\n') * ';'
end
