forked from Albeoris/Memoria
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLoadMonoDynamically.h
More file actions
32 lines (25 loc) · 1.04 KB
/
LoadMonoDynamically.h
File metadata and controls
32 lines (25 loc) · 1.04 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
#pragma once
// https://github.com/Unity-Technologies/mono/tree/unity-staging/unity/smalltestcases/asyncsocketshutdown
#include <Windows.h>
// define a ProcPtr type for each API
#define DO_API(r, n, p) typedef r(*fp_##n) p;
#include "MonoFunctions.h"
// declare storage for each API's function pointers
#define DO_API(r, n, p) fp_##n n = NULL;
#include "MonoFunctions.h"
HMODULE gMonoModule;
inline int SetupMono()
{
gMonoModule = LoadLibraryW(L"Unity_Data\\Mono\\mono.dll");
if (!gMonoModule) {
return 1;
}
bool success = true;
#define DO_API(r, n, p) \
n = (fp_##n)GetProcAddress(gMonoModule, #n); \
if (!n) { \
success = false; \
}
#include "MonoFunctions.h"
return success ? 0 : 2;
}