示例#1
0
文件: Loader.cs 项目: mindis/Spreads
        IntPtr INativeLibraryLoader.LoadLibrary(string path)
        {
            Trace.WriteLine("Opening a library: " + path);
            try
            {
                int flags  = GetDLOpenFlags();
                var result = UnixLibraryLoader.dlopen(path, flags);
                Trace.WriteLine("Open result: " + result);
                if (result == IntPtr.Zero)
                {
                    var lastError = dlerror();
                    Trace.WriteLine($"Failed to load native library \"{path}\".\r\nLast Error:{lastError}\r\nCheck inner exception and\\or windows event log.");
                }
                return(result);
            }
            catch (Exception ex)
            {
                var lastError = dlerror();
                Trace.WriteLine($"Failed to load native library \"{path}\".\r\nLast Error:{lastError}\r\nCheck inner exception and\\or windows event log.\r\nInner Exception: {ex.ToString()}");

                Trace.WriteLine(ex.ToString());
                return(IntPtr.Zero);
            }
        }
示例#2
0
        IntPtr INativeLibraryLoader.LoadLibrary(string path)
        {
            int flags = GetDLOpenFlags();

            return(UnixLibraryLoader.dlopen(path, flags));
        }