You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**NativeLibrary** is a dependency mod for [WorldBox](https://www.superworldbox.com/)[NeoModLoader](https://github.com/WorldBoxOpenMods/ModLoader).
4
+
It provides automated loading of managed DLLs and native libraries within the modding ecosystem.
5
+
This mod simplifies the integration of external libraries by handling the loading process at runtime,
6
+
eliminating the need for explicit calls to `LoadLibrary` or `Assembly.Load`.
7
+
8
+
Please note that due to the complexities involved in performing **shading** or **relocation** operations at runtime,
9
+
**NativeLibrary** does **not offer any mechanisms for dependency isolation**.
10
+
For native libraries, users may achieve isolation by manually renaming binary files.
11
+
However, this approach is not possible for managed DLLs,
12
+
and potential conflicts must be managed externally.
13
+
14
+
## Features
15
+
16
+
***Automated Libraries Loading**: Automatically loads both **managed DLLs** and **native libraries** without requiring manual intervention in code.
17
+
***Dependency Integration**: Acts as a foundational mod that other mods can depend on for library management.
18
+
***No Isolation Support**: Explicitly does not provide **shading** or **relocation** to isolate dependencies, prioritizing simplicity and runtime efficiency.
19
+
20
+
## Usage
21
+
22
+
1. Include the GUID of `NativeLibrary` in the dependencies list of your `mod.json` file. For example:
23
+
24
+
```json5
25
+
{
26
+
"Dependencies": ["NATIVELIBRARY"],
27
+
// or
28
+
"OptionalDependencies": ["NATIVELIBRARY"]
29
+
}
30
+
```
31
+
32
+
2. Place managed DLLs directly in the `NativeLibrary` folder.
33
+
34
+
For native libraries, place them in architecture-specific subfolders under `NativeLibrary` (supported: `x86_64` and `arm64`, based on **WorldBox** target platform).
35
+
36
+
The mod automatically loads the correct binary (`.dll` on **Windows**, `.so` on **Linux**, `.dylib` on **macOS**) for the operating system.
37
+
38
+
For details on native library loading, see [Native library loading](https://learn.microsoft.com/dotnet/standard/native-interop/native-library-loading).
39
+
40
+
Example structure:
41
+
42
+
```
43
+
NativeLibrary/
44
+
├── Managed.dll
45
+
├── x86_64/
46
+
│ ├── native.dll
47
+
│ ├── libnative.so
48
+
│ └── libnative.dylib
49
+
└── arm64/
50
+
└── libnative.dylib
51
+
```
52
+
53
+
3. For native libraries, you still need to use `DllImport`
0 commit comments