-
Notifications
You must be signed in to change notification settings - Fork 396
Expand file tree
/
Copy pathNativeMethods.Unix.cs
More file actions
72 lines (53 loc) · 1.36 KB
/
NativeMethods.Unix.cs
File metadata and controls
72 lines (53 loc) · 1.36 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
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace ReClassNET.Native
{
internal class NativeMethodsUnix : INativeMethods
{
#region Imports
private const int RTLD_NOW = 2;
[DllImport("__Internal")]
private static extern IntPtr dlopen(string fileName, int flags);
[DllImport("__Internal")]
private static extern IntPtr dlsym(IntPtr handle, string symbol);
[DllImport("__Internal")]
private static extern int dlclose(IntPtr handle);
#endregion
public IntPtr LoadLibrary(string fileName)
{
return dlopen(fileName, RTLD_NOW);
}
public IntPtr GetProcAddress(IntPtr handle, string name)
{
// Warning: dlsym could return IntPtr.Zero to a valid function.
// Error checking with dlerror is needed but we treat IntPtr.Zero as error value...
return dlsym(handle, name);
}
public void FreeLibrary(IntPtr handle)
{
dlclose(handle);
}
public Icon GetIconForFile(string path)
{
return null;
}
public void EnableDebugPrivileges()
{
}
public string UndecorateSymbolName(string name)
{
return name;
}
public void SetProcessDpiAwareness()
{
}
public bool RegisterExtension(string fileExtension, string extensionId, string applicationPath, string applicationName)
{
return false;
}
public void UnregisterExtension(string fileExtension, string extensionId)
{
}
}
}