public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals) { var decl = typedef.Declaration; TypeMap typeMap = null; if (Context.Driver.TypeDatabase.FindTypeMap(decl, out typeMap)) { typeMap.Type = typedef; typeMap.CLIMarshalToManaged(Context); return(typeMap.IsValueType); } FunctionType function; if (decl.Type.IsPointerTo(out function)) { Context.Return.Write("safe_cast<{0}>(", typedef); Context.Return.Write("System::Runtime::InteropServices::Marshal::"); Context.Return.Write("GetDelegateForFunctionPointer("); Context.Return.Write("IntPtr({0}), {1}::typeid))", Context.ReturnVarName, typedef.ToString().TrimEnd('^')); return(true); } return(decl.Type.Visit(this)); }