2 using System.Runtime.InteropServices;
4 namespace Efl { namespace Eo {
6 public partial class NativeModule
8 public const int RTLD_NOW = 0x002;
9 // Currently we are using GLOBAL due to issues
10 // with the way evas modules are built.
11 public const int RTLD_GLOBAL = 0x100;
13 [DllImport(efl.Libs.Libdl)]
14 public static extern IntPtr dlopen(string fileName, int flag);
15 [DllImport(efl.Libs.Libdl)]
16 public static extern int dlclose(IntPtr handle);
18 public static void UnloadLibrary(IntPtr handle)
23 public static IntPtr LoadLibrary(string filename)
25 Eina.Log.Debug($"Loading library {filename}");
26 var r = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
29 r = dlopen("lib" + filename, RTLD_NOW | RTLD_GLOBAL);
32 r = dlopen(filename + ".so", RTLD_NOW | RTLD_GLOBAL);
35 r = dlopen("lib" + filename + ".so", RTLD_NOW | RTLD_GLOBAL);