Class NativeLibLoader
Inheritance
object
NativeLibLoader
Assembly: NativeLibUtils.dll
Syntax
public static class NativeLibLoader : Object
Methods
CallLibFunc<delegateT>(IntPtr, string, ProcCaller<delegateT>)
Declaration
public static bool CallLibFunc<delegateT>(IntPtr dllHandle, string funcName, NativeLibLoader.ProcCaller<delegateT> caller) where delegateT : class
Parameters
Returns
Type Parameters
Name |
Description |
delegateT |
|
CallLibFunc<delegateT>(string, string, ProcCaller<delegateT>)
Declaration
public static bool CallLibFunc<delegateT>(string libName, string funcName, NativeLibLoader.ProcCaller<delegateT> caller) where delegateT : class
Parameters
Returns
Type Parameters
Name |
Description |
delegateT |
|
CreateComObject<T, TD>(string, string, out IntPtr, out IntPtr)
Create COM object from export DLL function which returns pointer to object
Declaration
public static T? CreateComObject<T, TD>(string dllPath, string functionName, out IntPtr objectPointer, out IntPtr dllPointer) where T : class where TD : Delegate
Parameters
Type |
Name |
Description |
string |
dllPath |
Path do native DLL with export function
|
string |
functionName |
Calling function
|
System.IntPtr |
objectPointer |
Pointer to created object, so it could be released later
|
System.IntPtr |
dllPointer |
Pointer to DLL, so it could be free later
|
Returns
Type Parameters
Name |
Description |
T |
Interface of returning object
|
TD |
Delegate to method which will be called inside DLL and return pointer to object
|
CreateComObjectWithParams<T, TD>(string, string, object?[]?, out IntPtr, out IntPtr)
Create COM object from export DLL function which returns pointer to object
Declaration
public static T? CreateComObjectWithParams<T, TD>(string dllPath, string functionName, object?[]? args, out IntPtr objectPointer, out IntPtr dllPointer) where T : class where TD : Delegate
Parameters
Type |
Name |
Description |
string |
dllPath |
Path do native DLL with export function
|
string |
functionName |
Calling function
|
object[] |
args |
Arguments to be provided in delegate method
|
System.IntPtr |
objectPointer |
Pointer to created object, so it could be released later
|
System.IntPtr |
dllPointer |
Pointer to DLL, so it could be free later
|
Returns
Type Parameters
Name |
Description |
T |
Interface of returning object
|
TD |
Delegate to method which will be called inside DLL and return pointer to object
|
FreeDll(IntPtr)
Declaration
public static void FreeDll(IntPtr handle)
Parameters
Type |
Name |
Description |
System.IntPtr |
handle |
|
FreeDll(object?, IntPtr, IntPtr)
Free DLL after it was called to create COM object
Declaration
public static void FreeDll(object? comObject, IntPtr objectPointer, IntPtr dllPointer)
Parameters
Type |
Name |
Description |
object |
comObject |
Created object
|
System.IntPtr |
objectPointer |
Pointer to created object
|
System.IntPtr |
dllPointer |
Pointer to destroying DLL
|
GetDelegate<T>(IntPtr, string)
Declaration
public static T? GetDelegate<T>(IntPtr dllHandle, string procName) where T : Delegate
Parameters
Type |
Name |
Description |
System.IntPtr |
dllHandle |
|
string |
procName |
|
Returns
Type Parameters
GetProc<delegateT>(IntPtr, string)
Declaration
public static delegateT GetProc<delegateT>(IntPtr dllHandle, string procName) where delegateT : class
Parameters
Type |
Name |
Description |
System.IntPtr |
dllHandle |
|
string |
procName |
|
Returns
Type |
Description |
delegateT |
|
Type Parameters
Name |
Description |
delegateT |
|
GetResStringFromDll(IntPtr, int)
Declaration
public static string GetResStringFromDll(IntPtr dll, int strid)
Parameters
Type |
Name |
Description |
System.IntPtr |
dll |
|
int |
strid |
|
Returns
LoadDll(string, out int)
Declaration
public static IntPtr LoadDll(string libName, out int errorCode)
Parameters
Type |
Name |
Description |
string |
libName |
|
int |
errorCode |
|
Returns
Type |
Description |
System.IntPtr |
|
LoadDll(string)
Declaration
public static IntPtr LoadDll(string libName)
Parameters
Type |
Name |
Description |
string |
libName |
|
Returns
Type |
Description |
System.IntPtr |
|
LoadDllAsData(string, out int)
Declaration
public static IntPtr LoadDllAsData(string libName, out int errorCode)
Parameters
Type |
Name |
Description |
string |
libName |
|
int |
errorCode |
|
Returns
Type |
Description |
System.IntPtr |
|
LoadDllAsData(string)
Declaration
public static IntPtr LoadDllAsData(string libName)
Parameters
Type |
Name |
Description |
string |
libName |
|
Returns
Type |
Description |
System.IntPtr |
|