Skip to content

Commit

Permalink
Added MonoPInvokeCallback to methods that will be called from unmanag…
Browse files Browse the repository at this point in the history
…ed code
  • Loading branch information
JordanL8 committed Sep 7, 2023
1 parent 0c3e1b4 commit 7b0dca4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Generator/Generators/CSharp/CSharpSources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,9 @@ private void GenerateVTableMethodDelegates(Class @class, Method method)

WriteLine($"private static {method.FunctionType} {vTableMethodDelegateName}Instance;");
NewLine();

WriteLine("#if ENABLE_IL2CPP");
WriteLine($"[AOT.MonoPInvokeCallback(typeof({method.FunctionType}))]");
WriteLine("#endif");
using (WriteBlock($"private static {retType} {vTableMethodDelegateName}Hook({string.Join(", ", @params)})"))
{
WriteLine($@"var {Helpers.TargetIdentifier} = {@class.Visit(TypePrinter)}.__GetInstance({Helpers.InstanceField});");
Expand Down

0 comments on commit 7b0dca4

Please sign in to comment.