MemoryModule 0.1.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 and Polyglot Notebooks. 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                

MemoryModule.NET

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)

Features:

  • 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;

        [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
        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");
            greetFunc();

            asm.Dispose();

See the DemoApp for more details.

Known issues

  • Beware of 64-bit dll files compiled using g++: https://github.com/fancycode/MemoryModule/issues/108. 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 Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
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.55 79 3/13/2024
0.2.0-dev.53 136 12/30/2023
0.2.0-dev.52 100 12/17/2023
0.2.0-dev.51 78 12/16/2023
0.2.0-dev.47 74 12/15/2023
0.2.0-dev.43 75 12/15/2023
0.2.0-dev.41 79 12/15/2023
0.2.0-dev.33 159 8/11/2022
0.2.0-dev.31 108 8/11/2022
0.2.0-dev.28 268 10/17/2021
0.2.0-dev.26 186 9/10/2021
0.2.0-dev.21 170 9/9/2021
0.1.0 534 8/25/2021