-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathPlatformSpecificHelpersTypeAdder.cs
More file actions
434 lines (370 loc) · 22.9 KB
/
PlatformSpecificHelpersTypeAdder.cs
File metadata and controls
434 lines (370 loc) · 22.9 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
//-----------------------------------------------------------------------
// <copyright file="PlatformSpecificHelpersTypeAdder.cs" company="Microsoft">
// Copyright (c) Microsoft. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace PInvokeCompiler
{
using System.Collections.Generic;
using Microsoft.Cci;
using Microsoft.Cci.MutableCodeModel;
internal sealed class PlatformSpecificHelpersTypeAdder
{
public PlatformSpecificHelpersTypeAdder(IMetadataHost host, ITypeDefinition typeDef, ITypeReference marshalClass)
{
var libc = new ModuleReference
{
ModuleIdentity = new ModuleIdentity(host.NameTable.GetNameFor("libc"), "unknown://location")
};
var libdl = new ModuleReference
{
ModuleIdentity = new ModuleIdentity(host.NameTable.GetNameFor("libdl"), "unknown://location")
};
var libSystem = new ModuleReference
{
ModuleIdentity = new ModuleIdentity(host.NameTable.GetNameFor("libSystem"), "unknown://location")
};
var kernel32 = new ModuleReference
{
ModuleIdentity = new ModuleIdentity(host.NameTable.GetNameFor("kernel32"), "unknown://location")
};
var linux = CreateUnixSpecificHelpers(host, typeDef, "linux_", "dlopen", "dlclose", "dlsym", libdl, PInvokeCallingConvention.CDecl);
var darwin = CreateUnixSpecificHelpers(host, typeDef, "darwin_", "dlopen", "dlclose", "dlsym", libSystem, PInvokeCallingConvention.CDecl);
var bsd = CreateUnixSpecificHelpers(host, typeDef, "bsd_", "dlopen", "dlclose", "dlsym", libc, PInvokeCallingConvention.CDecl);
var windows = CreateWindowsHelpers(host, typeDef, "windows_", "LoadLibrary", "FreeLibrary", "GetProcAddress", kernel32, PInvokeCallingConvention.WinApi);
var unix = CreateUnixHelpers(host, typeDef, marshalClass, linux, darwin, bsd, libc);
this.WindowsLoaderMethods = new WindowsLoaderMethods
{
LoadLibrary = windows[0],
FreeLibrary = windows[1],
GetProcAddress = windows[2]
};
this.UnixLoaderMethods = new UnixLoaderMethods
{
LoadLibrary = unix[0],
FreeLibrary = unix[1],
GetProcAddress = unix[2]
};
this.Methods = new List<IMethodDefinition>();
this.Methods.AddRange(linux);
this.Methods.AddRange(darwin);
this.Methods.AddRange(bsd);
this.Methods.AddRange(windows);
this.Methods.AddRange(unix);
}
public IWindowsLoaderMethods WindowsLoaderMethods { get; }
public IUnixLoaderMethods UnixLoaderMethods { get; }
public List<IMethodDefinition> Methods { get; }
private static List<IMethodDefinition> CreateWindowsHelpers(
IMetadataHost host,
ITypeDefinition typeDef,
string prefix,
string loadLibraryMethodName,
string freeLibraryMethodName,
string getProcAddressMethodName,
IModuleReference moduleRef,
PInvokeCallingConvention callingConvention)
{
var loadLibrary = CreateLoadLibraryMethod(host, typeDef, moduleRef, prefix, loadLibraryMethodName, callingConvention);
var freeLibrary = CreateFreeLibraryMethod(host, typeDef, moduleRef, prefix, freeLibraryMethodName, callingConvention);
var getProcAddress = CreateGetProcAddressMethod(host, typeDef, moduleRef, prefix, getProcAddressMethodName, callingConvention);
return new List<IMethodDefinition> { loadLibrary, freeLibrary, getProcAddress };
}
private static List<IMethodDefinition> CreateUnixSpecificHelpers(
IMetadataHost host,
ITypeDefinition typeDef,
string prefix,
string loadLibraryMethodName,
string freeLibraryMethodName,
string getProcAddressMethodName,
IModuleReference moduleRef,
PInvokeCallingConvention callingConvention)
{
var loadLibrary = CreateLoadLibraryMethod(host, typeDef, moduleRef, prefix, loadLibraryMethodName, callingConvention);
loadLibrary.Parameters.Add(new ParameterDefinition { Index = 1, Type = host.PlatformType.SystemInt32 });
var freeLibrary = CreateFreeLibraryMethod(host, typeDef, moduleRef, prefix, freeLibraryMethodName, callingConvention);
var getProcAddress = CreateGetProcAddressMethod(host, typeDef, moduleRef, prefix, getProcAddressMethodName, callingConvention);
return new List<IMethodDefinition> { loadLibrary, freeLibrary, getProcAddress };
}
private static MethodDefinition CreateLoadLibraryMethod(IMetadataHost host, ITypeDefinition typeDef, IModuleReference moduleRef, string prefix, string loadLibraryMethodName, PInvokeCallingConvention callingConvention)
{
return CreatePInvokeMethod(
host,
typeDef,
new List<IParameterDefinition> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemString } },
host.PlatformType.SystemIntPtr,
moduleRef,
prefix,
loadLibraryMethodName,
callingConvention);
}
private static MethodDefinition CreateFreeLibraryMethod(IMetadataHost host, ITypeDefinition typeDef, IModuleReference moduleRef, string prefix, string freeLibraryMethodName, PInvokeCallingConvention callingConvention)
{
return CreatePInvokeMethod(
host,
typeDef,
new List<IParameterDefinition> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemIntPtr } },
host.PlatformType.SystemInt32,
moduleRef,
prefix,
freeLibraryMethodName,
callingConvention);
}
private static MethodDefinition CreateGetProcAddressMethod(IMetadataHost host, ITypeDefinition typeDef, IModuleReference moduleRef, string prefix, string getProcAddressMethodName, PInvokeCallingConvention callingConvention)
{
return CreatePInvokeMethod(
host,
typeDef,
new List<IParameterDefinition> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemIntPtr }, new ParameterDefinition { Index = 1, Type = host.PlatformType.SystemString } },
host.PlatformType.SystemIntPtr,
moduleRef,
prefix,
getProcAddressMethodName,
callingConvention);
}
private static MethodDefinition CreatePInvokeMethod(IMetadataHost host, ITypeDefinition typeDef, List<IParameterDefinition> parameters, ITypeReference returnType, IModuleReference moduleRef, string prefix, string methodName, PInvokeCallingConvention callingConvention)
{
return new MethodDefinition
{
ContainingTypeDefinition = typeDef,
Type = returnType,
Parameters = parameters,
Name = host.NameTable.GetNameFor(prefix + methodName),
Visibility = TypeMemberVisibility.Public,
IsStatic = true,
IsPlatformInvoke = true,
PreserveSignature = true,
IsHiddenBySignature = true,
IsExternal = true,
PlatformInvokeData = new PlatformInvokeInformation
{
PInvokeCallingConvention = callingConvention,
ImportModule = moduleRef,
ImportName = host.NameTable.GetNameFor(methodName)
}
};
}
private static IMethodDefinition CreateGetOperatingSystemMethod(IMetadataHost host, ITypeDefinition typeDef, IMethodReference stringOPEquality, IMethodReference uname)
{
var methodDefinition = new MethodDefinition
{
Name = host.NameTable.GetNameFor("GetOperatingSystem"),
IsStatic = true,
ContainingTypeDefinition = typeDef,
IsHiddenBySignature = true,
Visibility = TypeMemberVisibility.Private,
Type = host.PlatformType.SystemInt32
};
ILGenerator ilGenerator = new ILGenerator(host, methodDefinition);
ilGenerator.Emit(OperationCode.Call, uname);
ilGenerator.Emit(OperationCode.Stloc_0);
var linuxLabel = new ILGeneratorLabel();
var darwinLabel = new ILGeneratorLabel();
var freebsdLabel = new ILGeneratorLabel();
var netbsdLabel = new ILGeneratorLabel();
var unknownLabel = new ILGeneratorLabel();
AddOperatingSystemCase(ilGenerator, "Linux", stringOPEquality, linuxLabel);
AddOperatingSystemCase(ilGenerator, "Darwin", stringOPEquality, darwinLabel);
AddOperatingSystemCase(ilGenerator, "FreeBSD", stringOPEquality, freebsdLabel);
AddOperatingSystemCase(ilGenerator, "NetBSD", stringOPEquality, netbsdLabel);
ilGenerator.Emit(OperationCode.Br_S, unknownLabel);
ilGenerator.MarkLabel(linuxLabel);
ilGenerator.Emit(OperationCode.Ldc_I4_1);
ilGenerator.Emit(OperationCode.Ret);
ilGenerator.MarkLabel(darwinLabel);
ilGenerator.Emit(OperationCode.Ldc_I4_2);
ilGenerator.Emit(OperationCode.Ret);
ilGenerator.MarkLabel(freebsdLabel);
ilGenerator.Emit(OperationCode.Ldc_I4_3);
ilGenerator.Emit(OperationCode.Ret);
ilGenerator.MarkLabel(netbsdLabel);
ilGenerator.Emit(OperationCode.Ldc_I4_4);
ilGenerator.Emit(OperationCode.Ret);
ilGenerator.MarkLabel(unknownLabel);
ilGenerator.Emit(OperationCode.Ldc_I4_0);
ilGenerator.Emit(OperationCode.Ret);
methodDefinition.Body = new ILGeneratorMethodBody(ilGenerator, true, 2, methodDefinition, new List<ILocalDefinition> { new LocalDefinition { Type = host.PlatformType.SystemString } }, new List<ITypeDefinition>());
return methodDefinition;
}
private static void AddOperatingSystemCase(ILGenerator ilGenerator, string operatingSystemName, IMethodReference stringOPEquality, ILGeneratorLabel operatingSystemSwitchLabel)
{
ilGenerator.Emit(OperationCode.Ldloc_0);
ilGenerator.Emit(OperationCode.Ldstr, operatingSystemName);
ilGenerator.Emit(OperationCode.Call, stringOPEquality);
ilGenerator.Emit(OperationCode.Brtrue_S, operatingSystemSwitchLabel);
}
private static IMethodDefinition CreateUnameMethod(IMetadataHost host, ITypeDefinition typeDef, IFieldReference intPtrZero, IMethodReference allocHGlobal, IMethodReference ptrToStringAnsi, IMethodReference freeHGlobal, IMethodReference unamePInvoke, IMethodReference intPtrOpInequality)
{
var methodDefinition = new MethodDefinition
{
Name = host.NameTable.GetNameFor("uname"),
IsStatic = true,
IsHiddenBySignature = true,
ContainingTypeDefinition = typeDef,
Visibility = TypeMemberVisibility.Private,
Type = host.PlatformType.SystemString
};
var ilGenerator = new ILGenerator(host, methodDefinition);
ilGenerator.Emit(OperationCode.Ldsfld, intPtrZero);
ilGenerator.Emit(OperationCode.Stloc_0);
ilGenerator.BeginTryBody();
ilGenerator.Emit(OperationCode.Ldc_I4, 4096);
ilGenerator.Emit(OperationCode.Call, allocHGlobal);
ilGenerator.Emit(OperationCode.Stloc_0);
ilGenerator.Emit(OperationCode.Ldloc_0);
ilGenerator.Emit(OperationCode.Call, unamePInvoke);
var emptyStringLabel = new ILGeneratorLabel();
ilGenerator.Emit(OperationCode.Brtrue_S, emptyStringLabel);
ilGenerator.Emit(OperationCode.Ldloc_0);
ilGenerator.Emit(OperationCode.Call, ptrToStringAnsi);
ilGenerator.Emit(OperationCode.Stloc_1);
var exitLabel = new ILGeneratorLabel();
var endFinallyLabel = new ILGeneratorLabel();
ilGenerator.Emit(OperationCode.Leave_S, exitLabel);
ilGenerator.MarkLabel(emptyStringLabel);
ilGenerator.Emit(OperationCode.Ldstr, "");
ilGenerator.Emit(OperationCode.Stloc_1);
ilGenerator.Emit(OperationCode.Leave_S, exitLabel);
ilGenerator.BeginFinallyBlock();
ilGenerator.Emit(OperationCode.Ldloc_0);
ilGenerator.Emit(OperationCode.Ldsfld, intPtrZero);
ilGenerator.Emit(OperationCode.Call, intPtrOpInequality);
ilGenerator.Emit(OperationCode.Brfalse_S, endFinallyLabel);
ilGenerator.Emit(OperationCode.Ldloc_0);
ilGenerator.Emit(OperationCode.Call, freeHGlobal);
ilGenerator.MarkLabel(endFinallyLabel);
ilGenerator.Emit(OperationCode.Endfinally);
ilGenerator.EndTryBody();
ilGenerator.MarkLabel(exitLabel);
ilGenerator.Emit(OperationCode.Ldloc_1);
ilGenerator.Emit(OperationCode.Ret);
methodDefinition.Body = new ILGeneratorMethodBody(ilGenerator, true, 2, methodDefinition, new List<ILocalDefinition> { new LocalDefinition { Type = host.PlatformType.SystemIntPtr }, new LocalDefinition { Type = host.PlatformType.SystemString } }, new List<ITypeDefinition>());
return methodDefinition;
}
private static IMethodDefinition CreateUnamePInvokeMethod(IMetadataHost host, ITypeDefinition typeDef, IModuleReference libc)
{
return CreatePInvokeMethod(host, typeDef, new List<IParameterDefinition> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemIntPtr } }, host.PlatformType.SystemInt32, libc, string.Empty, "uname", PInvokeCallingConvention.CDecl);
}
private static IMethodDefinition CreateDLOpen(IMetadataHost host, ITypeDefinition typeDef, IMethodReference getOperatingSystem, IMethodReference linuxHelpers, IMethodReference darwinHelpers, IMethodReference bsdHelpers)
{
return CreateDLMethod(host, typeDef, host.NameTable.GetNameFor("dlopen"), new List<IParameterDefinition> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemString }, new ParameterDefinition { Index = 1, Type = host.PlatformType.SystemInt32 } }, host.PlatformType.SystemIntPtr, getOperatingSystem, linuxHelpers, darwinHelpers, bsdHelpers);
}
private static IMethodDefinition CreateDLClose(IMetadataHost host, ITypeDefinition typeDef, IMethodReference getOperatingSystem, IMethodReference linuxHelpers, IMethodReference darwinHelpers, IMethodReference bsdHelpers)
{
return CreateDLMethod(host, typeDef, host.NameTable.GetNameFor("dlclose"), new List<IParameterDefinition> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemIntPtr }, new ParameterDefinition { Index = 1, Type = host.PlatformType.SystemInt32 } }, host.PlatformType.SystemInt32, getOperatingSystem, linuxHelpers, darwinHelpers, bsdHelpers, generateSecondLoad: false);
}
private static IMethodDefinition CreateDLSym(IMetadataHost host, ITypeDefinition typeDef, IMethodReference getOperatingSystem, IMethodReference linuxHelpers, IMethodReference darwinHelpers, IMethodReference bsdHelpers)
{
return CreateDLMethod(host, typeDef, host.NameTable.GetNameFor("dlsym"), new List<IParameterDefinition> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemIntPtr }, new ParameterDefinition { Index = 1, Type = host.PlatformType.SystemString } }, host.PlatformType.SystemIntPtr, getOperatingSystem, linuxHelpers, darwinHelpers, bsdHelpers);
}
private static IMethodDefinition CreateDLMethod(IMetadataHost host, ITypeDefinition typeDef, IName name, List<IParameterDefinition> parameters, ITypeReference returnType, IMethodReference getOperatingSystem, IMethodReference linuxHelpers, IMethodReference darwinHelpers, IMethodReference bsdHelpers, bool generateSecondLoad = true)
{
var methodDefinition = new MethodDefinition
{
Name = name,
Parameters = parameters,
ContainingTypeDefinition = typeDef,
IsStatic = true,
IsHiddenBySignature = true,
Visibility = TypeMemberVisibility.Public,
Type = returnType
};
var labels = new ILGeneratorLabel[4];
var linuxLabel = new ILGeneratorLabel();
var darwinLabel = new ILGeneratorLabel();
var bsdLabel = new ILGeneratorLabel();
var unknownLabel = new ILGeneratorLabel();
labels[0] = linuxLabel;
labels[1] = darwinLabel;
labels[2] = bsdLabel;
labels[3] = bsdLabel;
var ilGenerator = new ILGenerator(host, methodDefinition);
ilGenerator.Emit(OperationCode.Call, getOperatingSystem);
ilGenerator.Emit(OperationCode.Stloc_0);
ilGenerator.Emit(OperationCode.Ldloc_0);
ilGenerator.Emit(OperationCode.Ldc_I4_1);
ilGenerator.Emit(OperationCode.Sub);
ilGenerator.Emit(OperationCode.Switch, labels);
ilGenerator.Emit(OperationCode.Br_S, unknownLabel);
AddOperatingSystemCase2(ilGenerator, linuxHelpers, linuxLabel, generateSecondLoad);
AddOperatingSystemCase2(ilGenerator, darwinHelpers, darwinLabel, generateSecondLoad);
AddOperatingSystemCase2(ilGenerator, bsdHelpers, bsdLabel, generateSecondLoad);
ilGenerator.MarkLabel(unknownLabel);
ilGenerator.Emit(OperationCode.Ldstr, "Platform Not Supported");
var exceptionCtor = new Microsoft.Cci.MutableCodeModel.MethodReference
{
Name = host.NameTable.GetNameFor(".ctor"),
ContainingType = host.PlatformType.SystemException,
Type = host.PlatformType.SystemVoid,
CallingConvention = CallingConvention.HasThis,
Parameters = new List<IParameterTypeInformation> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemString } }
};
ilGenerator.Emit(OperationCode.Newobj, exceptionCtor);
ilGenerator.Emit(OperationCode.Throw);
methodDefinition.Body = new ILGeneratorMethodBody(ilGenerator, true, 2, methodDefinition, new List<ILocalDefinition> { new LocalDefinition { Type = host.PlatformType.SystemInt32 } }, new List<ITypeDefinition>());
return methodDefinition;
}
private static void AddOperatingSystemCase2(ILGenerator ilGenerator, IMethodReference helper, ILGeneratorLabel label, bool generateSecondLoad = true)
{
ilGenerator.MarkLabel(label);
ilGenerator.Emit(OperationCode.Ldarg_0);
if (generateSecondLoad)
{
ilGenerator.Emit(OperationCode.Ldarg_1);
}
ilGenerator.Emit(OperationCode.Call, helper);
ilGenerator.Emit(OperationCode.Ret);
}
private static List<IMethodDefinition> CreateUnixHelpers(IMetadataHost host, ITypeDefinition typeDef, ITypeReference marshalClass, List<IMethodDefinition> linuxMethodList, List<IMethodDefinition> darwinMethodList, List<IMethodDefinition> bsdMethodList, IModuleReference libc)
{
var intPtrZero = new FieldReference
{
Name = host.NameTable.GetNameFor("Zero"),
ContainingType = host.PlatformType.SystemIntPtr,
Type = host.PlatformType.SystemIntPtr
};
var allocalHGlobal = new Microsoft.Cci.MutableCodeModel.MethodReference
{
Name = host.NameTable.GetNameFor("AllocHGlobal"),
ContainingType = marshalClass,
Type = host.PlatformType.SystemIntPtr,
Parameters = new List<IParameterTypeInformation> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemInt32 } }
};
var ptrToStringAnsi = new Microsoft.Cci.MutableCodeModel.MethodReference
{
Name = host.NameTable.GetNameFor("PtrToStringAnsi"),
ContainingType = marshalClass,
Type = host.PlatformType.SystemString,
Parameters = new List<IParameterTypeInformation> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemIntPtr } }
};
var freeHGlobal = new Microsoft.Cci.MutableCodeModel.MethodReference
{
Name = host.NameTable.GetNameFor("FreeHGlobal"),
ContainingType = marshalClass,
Type = host.PlatformType.SystemVoid,
Parameters = new List<IParameterTypeInformation> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemIntPtr } }
};
var intPtrOpInEquality = new Microsoft.Cci.MutableCodeModel.MethodReference
{
Name = host.NameTable.OpInequality,
ContainingType = host.PlatformType.SystemIntPtr,
Type = host.PlatformType.SystemBoolean,
Parameters = new List<IParameterTypeInformation> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemIntPtr }, new ParameterDefinition { Index = 1, Type = host.PlatformType.SystemIntPtr } }
};
var stringOpEquality = new Microsoft.Cci.MutableCodeModel.MethodReference
{
Name = host.NameTable.OpEquality,
ContainingType = host.PlatformType.SystemString,
Type = host.PlatformType.SystemBoolean,
Parameters = new List<IParameterTypeInformation> { new ParameterDefinition { Index = 0, Type = host.PlatformType.SystemString }, new ParameterDefinition { Index = 1, Type = host.PlatformType.SystemString } }
};
var unamePInvokeMethod = CreateUnamePInvokeMethod(host, typeDef, libc);
var unameMethod = CreateUnameMethod(host, typeDef, intPtrZero, allocalHGlobal, ptrToStringAnsi, freeHGlobal, unamePInvokeMethod, intPtrOpInEquality);
var getosmethod = CreateGetOperatingSystemMethod(host, typeDef, stringOpEquality, unameMethod);
var dlopen = CreateDLOpen(host, typeDef, getosmethod, linuxMethodList[0], darwinMethodList[0], bsdMethodList[0]);
var dlclose = CreateDLClose(host, typeDef, getosmethod, linuxMethodList[1], darwinMethodList[1], bsdMethodList[1]);
var dlsym = CreateDLSym(host, typeDef, getosmethod, linuxMethodList[2], darwinMethodList[2], bsdMethodList[2]);
return new List<IMethodDefinition> { dlopen, dlclose, dlsym, unameMethod, unamePInvokeMethod, getosmethod };
}
}
}