MemoryModule 0.1.0

.NET Standard 2.0
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package MemoryModule --version 0.1.0
NuGet\Install-Package MemoryModule -Version 0.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MemoryModule" Version="0.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MemoryModule --version 0.1.0
#r "nuget: MemoryModule, 0.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MemoryModule as a Cake Addin
#addin nuget:?package=MemoryModule&version=0.1.0

// Install MemoryModule as a Cake Tool
#tool nuget:?package=MemoryModule&version=0.1.0


Loads unmanaged libraries right from your embedded resources! Works on Windows only, both on .NET Framework and .NET Core (and of course .NET 5.0)


  • Load x86 and x64 assemblies, right from the memory. No P/Invoke, no temporary files.
  • Correctly resolves loaded unmanaged libraries, and exposes a AssemblyResolve event for users to manually handle it.

Sample code:

using MemoryModule;

        delegate int addNumberProc(int a, int b);

            var asmBytes = File.ReadAllBytes($"SampleDLL.dll");

            var asm = NativeAssembly.Load(asmBytes);

            Console.WriteLine("Successfully loaded library.");
            var addNumberFunc = asm.GetDelegate<addNumberProc>("addNumbers");
            var rand = new Random();
            int num1 = rand.Next(0, 20);
            int num2 = rand.Next(0, 20);
            Console.WriteLine($"{num1}+{num2}={addNumberFunc(num1, num2)}");

            var greetFunc = asm.GetDelegate<GreetProc>("Greet");


See the DemoApp for more details.

Known issues

  • Beware of 64-bit dll files compiled using g++: These files must be compiled using -static-libgcc and -static-libstdc++ to load properly, in both the original C version and this version.
  • Resources are not supported.
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.0-dev.33 69 8/11/2022
0.2.0-dev.31 55 8/11/2022
0.2.0-dev.28 218 10/17/2021
0.2.0-dev.26 135 9/10/2021
0.2.0-dev.21 118 9/9/2021
0.1.0 251 8/25/2021