Skip to content

Commit 8df3b94

Browse files
committed
Added MonoPInvokeCallback to methods that will be called from unmanaged code
(cherry picked from commit 7b0dca4)
1 parent 493ec7d commit 8df3b94

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Generator/Generators/CSharp/CSharpSources.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,9 @@ private void GenerateVTableMethodDelegates(Class @class, Method method)
20992099

21002100
WriteLine($"private static {method.FunctionType} {vTableMethodDelegateName}Instance;");
21012101
NewLine();
2102-
2102+
WriteLine("#if ENABLE_IL2CPP");
2103+
WriteLine($"[AOT.MonoPInvokeCallback(typeof({method.FunctionType}))]");
2104+
WriteLine("#endif");
21032105
using (WriteBlock($"private static {retType} {vTableMethodDelegateName}Hook({string.Join(", ", @params)})"))
21042106
{
21052107
WriteLine($@"var {Helpers.TargetIdentifier} = {@class.Visit(TypePrinter)}.__GetInstance({Helpers.InstanceField});");

0 commit comments

Comments
 (0)