File tree 6 files changed +67
-8
lines changed
tasks/AppleAppBuilder/Templates
tests/FunctionalTests/iOS/Simulator 6 files changed +67
-8
lines changed Original file line number Diff line number Diff line change 96
96
<PropertyGroup >
97
97
<Optimized >true</Optimized >
98
98
<MainLibraryFileName Condition =" '$(MainLibraryFileName)' == ''" >AppleTestRunner.dll</MainLibraryFileName >
99
+ <_MobileIntermediateOutputPath Condition =" '$(RunAOTCompilation)' == 'true'" >$(IntermediateOutputPath)mobile</_MobileIntermediateOutputPath >
99
100
</PropertyGroup >
100
101
<ItemGroup >
101
102
<AotInputAssemblies Condition =" '$(RunAOTCompilation)' == 'true'" Include =" $(PublishDir)*.dll" Exclude =" $(PublishDir)System.Runtime.WindowsRuntime.dll" >
105
106
<BundleAssemblies Condition =" '$(RunAOTCompilation)' != 'true'" Include =" $(PublishDir)*.dll" />
106
107
</ItemGroup >
107
108
109
+ <MakeDir Directories =" $(_MobileIntermediateOutputPath)"
110
+ Condition =" '$(RunAOTCompilation)' == 'true'" />
108
111
<RemoveDir Directories =" $(BundleDir)" />
109
112
110
113
<MonoAOTCompiler Condition =" '$(RunAOTCompilation)' == 'true'"
111
114
CompilerBinaryPath =" $(MicrosoftNetCoreAppRuntimePackNativeDir)cross\$(PackageRID)\mono-aot-cross"
115
+ OutputDir =" $(_MobileIntermediateOutputPath)"
112
116
Mode =" Full"
113
117
OutputType =" AsmOnly"
114
118
Assemblies =" @(AotInputAssemblies)"
Original file line number Diff line number Diff line change @@ -64,6 +64,14 @@ - (void)viewDidLoad {
64
64
65
65
@end
66
66
67
+ // called from C#
68
+ void
69
+ invoke_external_native_api (void (*callback)(void ))
70
+ {
71
+ if (callback)
72
+ callback ();
73
+ }
74
+
67
75
// can be called from C# to update UI
68
76
void
69
77
mono_ios_set_summary (const char * value)
Original file line number Diff line number Diff line change 9
9
public static class Program
10
10
{
11
11
[ DllImport ( "__Internal" ) ]
12
- public extern static void mono_ios_append_output ( string value ) ;
13
-
14
- [ DllImport ( "__Internal" ) ]
15
- public extern static void mono_ios_set_summary ( string value ) ;
12
+ public static extern void mono_ios_set_summary ( string value ) ;
16
13
17
14
public static async Task < int > Main ( string [ ] args )
18
15
{
Original file line number Diff line number Diff line change 9
9
public static class Program
10
10
{
11
11
[ DllImport ( "__Internal" ) ]
12
- public extern static void mono_ios_append_output ( string value ) ;
13
-
14
- [ DllImport ( "__Internal" ) ]
15
- public extern static void mono_ios_set_summary ( string value ) ;
12
+ public static extern void mono_ios_set_summary ( string value ) ;
16
13
17
14
public static async Task < int > Main ( string [ ] args )
18
15
{
Original file line number Diff line number Diff line change
1
+ // Licensed to the .NET Foundation under one or more agreements.
2
+ // The .NET Foundation licenses this file to you under the MIT license.
3
+
4
+ using System ;
5
+ using System . Threading ;
6
+ using System . Threading . Tasks ;
7
+ using System . Runtime . InteropServices ;
8
+
9
+ public static class Program
10
+ {
11
+ [ DllImport ( "__Internal" ) ]
12
+ unsafe private static extern void invoke_external_native_api ( delegate * unmanaged< void > callback ) ;
13
+
14
+ private static int counter = 1 ;
15
+
16
+ [ UnmanagedCallersOnly ]
17
+ private static void Callback ( )
18
+ {
19
+ counter = 42 ;
20
+ }
21
+
22
+ [ DllImport ( "__Internal" ) ]
23
+ public static extern void mono_ios_set_summary ( string value ) ;
24
+
25
+ public static async Task < int > Main ( string [ ] args )
26
+ {
27
+ mono_ios_set_summary ( $ "Starting functional test") ;
28
+ unsafe {
29
+ delegate * unmanaged< void > unmanagedPtr = & Callback ;
30
+ invoke_external_native_api ( unmanagedPtr ) ;
31
+ }
32
+ Console . WriteLine ( "Done!" ) ;
33
+ await Task . Delay ( 5000 ) ;
34
+
35
+ return counter ;
36
+ }
37
+ }
Original file line number Diff line number Diff line change
1
+ <Project Sdk =" Microsoft.NET.Sdk" >
2
+ <PropertyGroup >
3
+ <OutputType >Exe</OutputType >
4
+ <MonoForceInterpreter >true</MonoForceInterpreter >
5
+ <RunAOTCompilation >false</RunAOTCompilation >
6
+ <TestRuntime >true</TestRuntime >
7
+ <TargetFrameworks >$(NetCoreAppCurrent)</TargetFrameworks >
8
+ <MainLibraryFileName >iOS.Simulator.PInvoke.Test.dll</MainLibraryFileName >
9
+ <IncludesTestRunner >false</IncludesTestRunner >
10
+ <ExpectedExitCode >42</ExpectedExitCode >
11
+ </PropertyGroup >
12
+
13
+ <ItemGroup >
14
+ <Compile Include =" Program.cs" />
15
+ </ItemGroup >
16
+ </Project >
You can’t perform that action at this time.
0 commit comments