Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
@ -245,6 +245,24 @@ namespace CppSharp.AST
select rootBaseProperty).FirstOrDefault();
}
public Method GetMethodByName(string methodName)
{
var method = Methods.FirstOrDefault(m => m.Name == methodName);
if (method != null)
return method;
method = Methods.FirstOrDefault(m => m.Name == methodName);
Declaration decl;
foreach (BaseClassSpecifier @base in Bases.Where(b => b.Type.IsTagDecl(out decl)))
method = @base.Class.GetMethodByName(methodName);
return null;
public override T Visit<T>(IDeclVisitor<T> visitor)
return visitor.VisitClassDecl(this);
@ -87,6 +87,7 @@ namespace CppSharp.AST
CallingConvention = CallingConvention.Default;
IsVariadic = false;
IsInline = false;
Signature = string.Empty;
public Function(Function function)
@ -1319,13 +1319,15 @@ namespace CppSharp.Generators.CSharp
if (hasReturn)
Write("var _ret = ");
if (method.IsGenerated)
// HACK: because of the non-shared v-table entries bug we must look for the real method by name
Method m = ((Class) method.Namespace).GetMethodByName(method.Name);
if (m.IsGenerated)
WriteLine("target.{0}({1});", SafeIdentifier(method.Name), string.Join(", ", marshals));
else
InvokeProperty(method, marshals);
InvokeProperty(m, marshals);