Table of Contents

Class DllLibrary

Namespace
Ecng.Interop
Assembly
Ecng.Interop.dll

Represents a base class that manages a DLL library and provides access to its exported functions.

public abstract class DllLibrary : Disposable, IDisposable
Inheritance
DllLibrary
Implements
Inherited Members
Extension Methods

Constructors

DllLibrary(string)

Represents a base class that manages a DLL library and provides access to its exported functions.

protected DllLibrary(string dllPath)

Parameters

dllPath string

The file path to the DLL.

Properties

DllPath

Gets the file path to the DLL.

public string DllPath { get; }

Property Value

string

DllVersion

Gets the version of the DLL by retrieving product information.

public Version DllVersion { get; }

Property Value

Version

Handler

Gets the pointer to the loaded DLL.

protected IntPtr Handler { get; }

Property Value

IntPtr

Methods

DisposeNative()

Disposes native resources associated with the DLL.

protected override void DisposeNative()

GetHandler<T>(string)

Retrieves a function pointer from the DLL and casts it to the specified delegate type.

protected T GetHandler<T>(string procName)

Parameters

procName string

The name of the procedure to retrieve.

Returns

T

A delegate of type T.

Type Parameters

T

The type of the delegate.

TryGetHandler<T>(string)

Attempts to retrieve a function pointer from the DLL as the specified delegate type. Returns null if not found.

protected T TryGetHandler<T>(string procName) where T : Delegate

Parameters

procName string

The name of the procedure to retrieve.

Returns

T

A delegate of type T, or null if the procedure is not found.

Type Parameters

T

The type of the delegate.