-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTest_ManagedUnsafe.h
48 lines (38 loc) · 920 Bytes
/
Test_ManagedUnsafe.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "Common.h"
namespace Test_ManagedUnsafe
{
// begin-snippet: Test_ManagedUnsafe_CPP
struct Args
{
int number1;
int number2;
int sum;
char returnMsg[128];
};
bool Run(dotnet_runtime::Library& a_lib)
{
bool ret = true;
typedef void (CORECLR_DELEGATE_CALLTYPE* custom_entry_point_fn)(void*);
auto fpTest_ManagedUnsafe_Struct = (custom_entry_point_fn)a_lib.GetCustomEntrypoint(
STR("LibNamespace.Test_ManagedUnsafe"),
STR("Test_ManagedUnsafe_Struct")
);
Args args;
args.number1 = 1;
args.number2 = 2;
fpTest_ManagedUnsafe_Struct(&args);
{ //sum
bool success = args.sum == 3;
LogTest(success, L"Test_ManagedUnsafe_Struct.Sum");
ret &= success;
}
{ // ReturnMsg
bool success = cmp(args.returnMsg, (char*)"Hello Ansi");
LogTest(success, L"Test_ManagedUnsafe_Struct.ReturnMsg");
ret &= success;
}
return ret;
}
// end-snippet
}