forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[mono][wasm] Fix function signature mismatch in m2n invoke (dotnet#10…
…1106) Fix signature mismatch
- Loading branch information
1 parent
2664379
commit f2ef142
Showing
13 changed files
with
157 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/mono/wasm/testassets/Wasm.Buid.Tests.Programs/UnmanagedCallback.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
public unsafe partial class Test | ||
{ | ||
public unsafe static int Main(string[] args) | ||
{ | ||
((IntPtr)(delegate* unmanaged<int,int>)&Interop.Managed8\u4F60Func).ToString(); | ||
|
||
Console.WriteLine($"main: {args.Length}"); | ||
Interop.UnmanagedFunc(); | ||
return 42; | ||
} | ||
} | ||
|
||
file partial class Interop | ||
{ | ||
[UnmanagedCallersOnly(EntryPoint = "ManagedFunc")] | ||
public static int Managed8\u4F60Func(int number) | ||
{ | ||
// called from UnmanagedFunc | ||
Console.WriteLine($"Managed8\u4F60Func({number}) -> 42"); | ||
return 42; | ||
} | ||
|
||
[DllImport("local", EntryPoint = "UnmanagedFunc")] | ||
public static extern void UnmanagedFunc(); // calls ManagedFunc | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include <stdio.h> | ||
int ManagedFunc(int number); | ||
|
||
void UnmanagedFunc() | ||
{ | ||
int ret = 0; | ||
printf("UnmanagedFunc calling ManagedFunc\n"); | ||
ret = ManagedFunc(123); | ||
printf("ManagedFunc returned %d\n", ret); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters