AdvancedDLSupport 1.2.0

An alternative approach to your typical P/Invoke.

There is a newer version of this package available.
See the version list below for details.
Install-Package AdvancedDLSupport -Version 1.2.0
dotnet add package AdvancedDLSupport --version 1.2.0
<PackageReference Include="AdvancedDLSupport" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AdvancedDLSupport --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

AdvanceDLSupport

Alternative approach to your usual P/Invoke!

Use C# interfaces to bind to native code - quick and easy usage of C API in C# code, on any platform.
Gone are the days of broken DllImport and annoying workarounds for the different runtimes.

Fully compatible with Mono, .NET Framework, .NET Core, and .NET Standard. Compatible with Mono DLL mapping on all
platforms and runtimes. Configurable and adaptible.

Why use ADL?

  1. Modern API - no more static classes, no more extern. Use your native API as if it were first-class objects.
  2. Flexibility - Inject your native API into your classes, change the library scanning logic, mix your managed and
    native code.
  3. Speed - ADL is blazing fast, and gives your native interop an edge. See performance increases that
    are at least 2 and up to 8 times faster than other, existing solutions.
  4. Easy to use - Not only is ADL simple to set up and get working, it's a breeze to maintain, and reduces
    clutter in your codebase.

Build & Test status

| | Travis (Linux - Mono & .NET Core) | Travis (OSX - Mono & .NET Core) | AppVeyor (Windows - .NET & .NET Core) | MyGet (Development) |
| ----------------- |------------------------------------------- | -------------------------------------- | ---------------------------------------- | ------------------------|
| x64 (Debug) | Build Status | Build Status | Build status | |
| x64 (Release | Build Status | Build Status | Build status | |
| x86 (Debug) | Build Status | Build Status | Build status | |
| x86 (Release) | Build Status | Build Status | Build status | |
| Any CPU (Debug) | Build Status | Build Status | Build status | Build Status | |
| Any CPU (Release) | Build Status | Build Status | Build status | |

Total project coverage: Codecov.io

Read the Docs, or get the MyGet development packages and get started.

Features

  • Supports all the typical P/Invoke patterns and constructs
  • Seamlessly mix native functions and managed code
  • Use more complex types, such as Nullable&lt;T&gt; and string without any extra code
  • Select library architectures at runtime
  • Select library names at runtime
  • Swappable native library search algorithms
  • Import global variables
  • Optional lazy loaded symbols
  • Optional Mono DllMap support

Basic Usage

  1. Declare your interface

     public interface IMyNativeLibrary
     {
     	long MyNativeGlobal { get; set; }
     	int MyNativeMultiply(int a, int b);
     	void MyOtherNativeFunction(MyStruct strct, ref MyStruct? maybeStruct);
     }
    
  2. Activate it

     const string MyLibraryName = "MyLibrary";
    
     var activator = new NativeLibraryBuilder();
     var library = activator.ActivateInterface<IMyNativeLibrary>(MyLibraryName);
    
  3. Use it

     library.MyNativeGlobal = 10;
    
     var result = library.MyNativeMultiply(5, 5);
    
     var myStruct = new MyStruct();
     MyStruct? myOtherStruct = null;
    
     library.MyOtherNativeFunction(myStruct, ref myOtherStruct);
    

See the Quickstart for more information.

Installation

Via your favourite Nuget UI, or

NuGet

Install-Package AdvancedDLSupport -ProjectName MyProject

MyGet

nuget sources Add -Name AdvancedDLSupport-develop -Source https://www.myget.org/F/advancedlsupport/api/v3/index.json
Install-Package AdvancedDLSupport -ProjectName MyProject

License

If the library's license doesn't fit your project or product, please contact us. Custom licensing options are
available, and we are always open to working something out that fits you - be it modified, commercial, or otherwise.

AdvancedDLSupport's public release is licensed under the GNU General Public License, Version 3 (GPLv3).
See the LICENSE for details. Without the support of the open-source movement, it would never have existed.

AdvanceDLSupport

Alternative approach to your usual P/Invoke!

Use C# interfaces to bind to native code - quick and easy usage of C API in C# code, on any platform.
Gone are the days of broken DllImport and annoying workarounds for the different runtimes.

Fully compatible with Mono, .NET Framework, .NET Core, and .NET Standard. Compatible with Mono DLL mapping on all
platforms and runtimes. Configurable and adaptible.

Why use ADL?

  1. Modern API - no more static classes, no more extern. Use your native API as if it were first-class objects.
  2. Flexibility - Inject your native API into your classes, change the library scanning logic, mix your managed and
    native code.
  3. Speed - ADL is blazing fast, and gives your native interop an edge. See performance increases that
    are at least 2 and up to 8 times faster than other, existing solutions.
  4. Easy to use - Not only is ADL simple to set up and get working, it's a breeze to maintain, and reduces
    clutter in your codebase.

Build & Test status

| | Travis (Linux - Mono & .NET Core) | Travis (OSX - Mono & .NET Core) | AppVeyor (Windows - .NET & .NET Core) | MyGet (Development) |
| ----------------- |------------------------------------------- | -------------------------------------- | ---------------------------------------- | ------------------------|
| x64 (Debug) | Build Status | Build Status | Build status | |
| x64 (Release | Build Status | Build Status | Build status | |
| x86 (Debug) | Build Status | Build Status | Build status | |
| x86 (Release) | Build Status | Build Status | Build status | |
| Any CPU (Debug) | Build Status | Build Status | Build status | Build Status | |
| Any CPU (Release) | Build Status | Build Status | Build status | |

Total project coverage: Codecov.io

Read the Docs, or get the MyGet development packages and get started.

Features

  • Supports all the typical P/Invoke patterns and constructs
  • Seamlessly mix native functions and managed code
  • Use more complex types, such as Nullable&lt;T&gt; and string without any extra code
  • Select library architectures at runtime
  • Select library names at runtime
  • Swappable native library search algorithms
  • Import global variables
  • Optional lazy loaded symbols
  • Optional Mono DllMap support

Basic Usage

  1. Declare your interface

     public interface IMyNativeLibrary
     {
     	long MyNativeGlobal { get; set; }
     	int MyNativeMultiply(int a, int b);
     	void MyOtherNativeFunction(MyStruct strct, ref MyStruct? maybeStruct);
     }
    
  2. Activate it

     const string MyLibraryName = "MyLibrary";
    
     var activator = new NativeLibraryBuilder();
     var library = activator.ActivateInterface<IMyNativeLibrary>(MyLibraryName);
    
  3. Use it

     library.MyNativeGlobal = 10;
    
     var result = library.MyNativeMultiply(5, 5);
    
     var myStruct = new MyStruct();
     MyStruct? myOtherStruct = null;
    
     library.MyOtherNativeFunction(myStruct, ref myOtherStruct);
    

See the Quickstart for more information.

Installation

Via your favourite Nuget UI, or

NuGet

Install-Package AdvancedDLSupport -ProjectName MyProject

MyGet

nuget sources Add -Name AdvancedDLSupport-develop -Source https://www.myget.org/F/advancedlsupport/api/v3/index.json
Install-Package AdvancedDLSupport -ProjectName MyProject

License

If the library's license doesn't fit your project or product, please contact us. Custom licensing options are
available, and we are always open to working something out that fits you - be it modified, commercial, or otherwise.

AdvancedDLSupport's public release is licensed under the GNU General Public License, Version 3 (GPLv3).
See the LICENSE for details. Without the support of the open-source movement, it would never have existed.

Release Notes

Implement an option to use calli when generating native code.

Showing the top 2 GitHub repositories that depend on AdvancedDLSupport:

Repository Stars
opentk/opentk
This Open Toolkit library is a fast, low-level C# wrapper for OpenGL and OpenAL. It can be used standalone or inside a GUI on Windows, Linux, Mac, Android and iOS.
Lombiq/Hastlayer-SDK
Turning .NET assemblies into FPGA hardware. See the Readme and https://hastlayer.com.

Read more about the GitHub Usage information on our documentation.

Version History

Version Downloads Last updated
3.2.0 302 3/8/2020
3.1.0 4,324 9/27/2019
3.0.0 2,945 6/9/2019
2.3.2 1,326 1/2/2019
2.3.1 233 12/21/2018
2.3.0 3,671 9/17/2018
2.2.0 321 8/26/2018
2.1.2 2,061 8/9/2018
2.1.0 1,054 7/26/2018
2.0.0 335 7/22/2018
1.3.0 15,336 4/20/2018
1.2.2 415 4/17/2018
1.2.1 513 4/13/2018
1.2.0 527 4/13/2018
1.1.0 387 3/20/2018
1.0.0 484 3/19/2018
Show less