-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathTest_ManagedEntryPoint.h
More file actions
59 lines (42 loc) · 1.24 KB
/
Test_ManagedEntryPoint.h
File metadata and controls
59 lines (42 loc) · 1.24 KB
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
49
50
51
52
53
54
55
56
57
58
59
#pragma once
#include "Common.h"
namespace Test_ManagedEntryPoint
{
// begin-snippet: Test_ManagedEntryPoint_Args_CPP
struct args
{
int number1;
int number2;
};
// end-snippet
bool Run(dotnet_runtime::Library& a_lib)
{
bool ret = true;
std::wcout << "Test_ManagedEntryPoint: " << std::endl;
args _args {1, 2};
{ // COMPONENT entry point
// begin-snippet: Test_ManagedEntryPoint_ComponentEntryPoint_CPP
auto fpTest_ComponentEntryPoint = a_lib.GetComponentEntrypoint(
STR("LibNamespace.Test_ManagedEntryPoint"),
STR("Test_ComponentEntryPoint")
);
bool success = fpTest_ComponentEntryPoint(&_args, sizeof(_args)) == 3;
LogTest(success, L"Test_ComponentEntryPoint");
// end-snippet
ret &= success;
}
{ // CUSTOM entry point
// begin-snippet: Test_ManagedEntryPoint_CustomEntryPoint_CPP
typedef int (CORECLR_DELEGATE_CALLTYPE* custom_entry_point_fn)(args);
auto fpTest_CustomEntryPoint = (custom_entry_point_fn)a_lib.GetCustomEntrypoint(
STR("LibNamespace.Test_ManagedEntryPoint"),
STR("Test_CustomEntryPoint")
);
bool success = fpTest_CustomEntryPoint(_args) == 3;
LogTest(success, L"Test_CustomEntryPoint");
// end-snippet
ret &= success;
}
return ret;
}
}