forked from enlightenment/efl
mono: encapsulate internal NativeModule
Summary: Depends on D10342 Depends on D10338 Test Plan: meson setup -Dbindings=mono,cxx -Dmono-beta=true Reviewers: lauromoura, segfaultxavi, Jaehyun_Cho Reviewed By: lauromoura Subscribers: cedric, #reviewers, #committers, woohyun Tags: #efl Differential Revision: https://phab.enlightenment.org/D10343
This commit is contained in:
parent
1db12b5fb4
commit
d59197d2ee
|
@ -19,14 +19,14 @@ namespace Efl.Eo
|
||||||
{
|
{
|
||||||
|
|
||||||
///<summary>Wraps a native module that was opened with dlopen/LoadLibrary.</summary>
|
///<summary>Wraps a native module that was opened with dlopen/LoadLibrary.</summary>
|
||||||
public partial class NativeModule : IDisposable
|
internal partial class NativeModule : IDisposable
|
||||||
{
|
{
|
||||||
private Lazy<IntPtr> module;
|
private Lazy<IntPtr> module;
|
||||||
private bool disposed = false;
|
private bool disposed = false;
|
||||||
|
|
||||||
///<summary>Lazily tries to load the module with the given name.</summary>
|
///<summary>Lazily tries to load the module with the given name.</summary>
|
||||||
///<param name="libName">The name of the module to load.</param>
|
///<param name="libName">The name of the module to load.</param>
|
||||||
public NativeModule(string libName)
|
internal NativeModule(string libName)
|
||||||
{
|
{
|
||||||
module = new Lazy<IntPtr>
|
module = new Lazy<IntPtr>
|
||||||
(() =>
|
(() =>
|
||||||
|
@ -36,7 +36,7 @@ public partial class NativeModule : IDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary>The module that was loaded.</summary>
|
///<summary>The module that was loaded.</summary>
|
||||||
public IntPtr Module
|
internal IntPtr Module
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ using System.Runtime.InteropServices;
|
||||||
namespace Efl.Eo
|
namespace Efl.Eo
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class NativeModule
|
internal partial class NativeModule
|
||||||
{
|
{
|
||||||
private const int RTLD_NOW = 0x002;
|
private const int RTLD_NOW = 0x002;
|
||||||
// Currently we are using GLOBAL due to issues
|
// Currently we are using GLOBAL due to issues
|
||||||
|
@ -33,7 +33,7 @@ public partial class NativeModule
|
||||||
|
|
||||||
///<summary>Closes the library handle.</summary>
|
///<summary>Closes the library handle.</summary>
|
||||||
///<param name="handle">The handle to the library.</param>
|
///<param name="handle">The handle to the library.</param>
|
||||||
public static void UnloadLibrary(IntPtr handle)
|
internal static void UnloadLibrary(IntPtr handle)
|
||||||
{
|
{
|
||||||
dlclose(handle);
|
dlclose(handle);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public partial class NativeModule
|
||||||
///</summary>
|
///</summary>
|
||||||
///<param name="filename">The name to search for.</param>
|
///<param name="filename">The name to search for.</param>
|
||||||
///<returns>The loaded library handle or <see cref="System.IntPtr.Zero"/> on failure.</returns>
|
///<returns>The loaded library handle or <see cref="System.IntPtr.Zero"/> on failure.</returns>
|
||||||
public static IntPtr LoadLibrary(string filename)
|
internal static IntPtr LoadLibrary(string filename)
|
||||||
{
|
{
|
||||||
Eina.Log.Debug($"Loading library {filename}");
|
Eina.Log.Debug($"Loading library {filename}");
|
||||||
var r = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
|
var r = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
|
||||||
|
|
|
@ -19,10 +19,10 @@ using System.Runtime.InteropServices;
|
||||||
namespace Efl.Eo
|
namespace Efl.Eo
|
||||||
{
|
{
|
||||||
|
|
||||||
public class partial NativeModule
|
internal class partial NativeModule
|
||||||
{
|
{
|
||||||
[DllImport(efl.Libs.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
|
[DllImport(efl.Libs.Kernel32, CharSet = CharSet.Unicode, SetLastError = true)]
|
||||||
public static extern IntPtr LoadLibrary(string libFilename);
|
internal static extern IntPtr LoadLibrary(string libFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue