public static void UnLoadUnmanagedLibrary() { #if USESAFELIB if (m_hLibrary != null && !m_hLibrary.IsClosed) { m_hLibrary.Close(); m_hLibrary.UnLoad(); m_hLibrary.Dispose(); m_hLibrary = null; } #endif }
private static void UnLoadUnmanagedLibrary() { if (!_hLibrary.IsClosed) { _hLibrary.Close(); do { // be sure to unload swipl.sll } while (_hLibrary.UnLoad()); // m_hLibrary.UnLoad(); _hLibrary.Dispose(); _hLibrary = null; } }
internal static extern IntPtr GetProcAddress(SafeLibraryHandle hModule, String procname);
internal static extern IntPtr dlsym(SafeLibraryHandle hModule, String procname);
public static void LoadUnmanagedLibrary(string fileName) { #if USESAFELIB if (m_hLibrary == null) { if (PrologCLR.IsLinux) { return; m_hLibrary = NativeMethodsLinux.LoadLibrary("/lib64/pl-6.0.3/lib/x86_64/libswipl.so"); if (m_hLibrary.IsInvalid) { PrologCLR.ConsoleTrace("IsInvalid LoadUnmanagedLibrary " + fileName); // int hr = Marshal.GetHRForLastWin32Error(); // Marshal.ThrowExceptionForHR(hr); } } else { m_hLibrary = NativeMethodsWindows.LoadLibrary(fileName); if (m_hLibrary.IsInvalid) { int hr = Marshal.GetHRForLastWin32Error(); Marshal.ThrowExceptionForHR(hr); } } } #endif }