forked from enlightenment/efl
csharp: Load library in permanent way for static members and not rely on leaks
Summary: The LoadFunctionPointer relied on leaks of NativeModules by not disposing them. Instead do direct loading without instantiating unnecessary objects. Reviewers: lauromoura, woohyun, brunobelo Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10258
This commit is contained in:
parent
b19953fe3a
commit
0839dbc611
|
@ -20,10 +20,10 @@ public partial class FunctionInterop
|
||||||
///<returns>A function pointer that can be used with delegates.</returns>
|
///<returns>A function pointer that can be used with delegates.</returns>
|
||||||
public static IntPtr LoadFunctionPointer(string moduleName, string functionName)
|
public static IntPtr LoadFunctionPointer(string moduleName, string functionName)
|
||||||
{
|
{
|
||||||
NativeModule module = new NativeModule(moduleName);
|
IntPtr module = NativeModule.LoadLibrary(moduleName);
|
||||||
Eina.Log.Debug($"searching {module.Module} for {functionName}");
|
Eina.Log.Debug($"searching {module} for {functionName}");
|
||||||
var s = FunctionInterop.dlsym(module.Module, functionName);
|
var s = FunctionInterop.dlsym(module, functionName);
|
||||||
Eina.Log.Debug($"searching {module.Module} for{functionName}, result {s}");
|
Eina.Log.Debug($"searching {module} for{functionName}, result {s}");
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue