diff options
author | Jeff Greene <hippiehunterenator@gmail.com> | 2017-09-15 22:51:40 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-09-15 22:51:40 +0300 |
commit | 3a1a99acefc9b84182ff5ebba254246d557e7163 (patch) | |
tree | 4e26b3dfdf83058493bd5ea1e72486334cb4c0ce /src/ILCompiler.CppCodeGen | |
parent | 9b22fdfd6c714d19f3e2c22e1db85727097e5dcb (diff) |
Implemented portable pinvoke infrastructure for CppCodeGen (#4503)
Diffstat (limited to 'src/ILCompiler.CppCodeGen')
-rw-r--r-- | src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs b/src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs index 2ee5e142d..88faf7d41 100644 --- a/src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs +++ b/src/ILCompiler.CppCodeGen/src/CppCodeGen/ILToCppImporter.cs @@ -917,6 +917,17 @@ namespace Internal.IL return; } + //this assumes that there will only ever be at most one RawPInvoke call in a given method + if (method.IsRawPInvoke()) + { + AppendLine(); + Append("PInvokeTransitionFrame __piframe"); + AppendSemicolon(); + AppendLine(); + Append("__pinvoke(&__piframe)"); + AppendSemicolon(); + } + TypeDesc constrained = null; if (opcode != ILOpcode.newobj) { @@ -1216,6 +1227,13 @@ namespace Internal.IL PushExpression(retKind, temp, retType); } AppendSemicolon(); + + if (method.IsRawPInvoke()) + { + AppendLine(); + Append("__pinvoke_return(&__piframe)"); + AppendSemicolon(); + } } private void PassCallArguments(MethodSignature methodSignature, TypeDesc thisArgument) |