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:
Felipe Magno de Almeida 2019-10-01 00:06:13 -03:00 committed by Lauro Moura
parent b19953fe3a
commit 0839dbc611
1 changed files with 4 additions and 4 deletions

View File

@ -20,10 +20,10 @@ public partial class FunctionInterop
///<returns>A function pointer that can be used with delegates.</returns>
public static IntPtr LoadFunctionPointer(string moduleName, string functionName)
{
NativeModule module = new NativeModule(moduleName);
Eina.Log.Debug($"searching {module.Module} for {functionName}");
var s = FunctionInterop.dlsym(module.Module, functionName);
Eina.Log.Debug($"searching {module.Module} for{functionName}, result {s}");
IntPtr module = NativeModule.LoadLibrary(moduleName);
Eina.Log.Debug($"searching {module} for {functionName}");
var s = FunctionInterop.dlsym(module, functionName);
Eina.Log.Debug($"searching {module} for{functionName}, result {s}");
return s;
}