예제 #1
0
        public IntPtr LoadUnmanagedLibrary(string name)
        {
            if (_unloadableNativeLibs.Contains(name))
            {
                return(IntPtr.Zero);
            }

            foreach (var projectPath in _projects.Values.Select(p => p.Project.ProjectDirectory))
            {
                foreach (var folder in NativeLibPathUtils.GetNativeSubfolderCandidates(RuntimeEnvironmentHelper.RuntimeEnvironment))
                {
                    var path = NativeLibPathUtils.GetProjectNativeLibPath(projectPath, folder);
                    if (Directory.Exists(path))
                    {
                        var handle = LoadUnamangedLibrary(path, name);
                        if (handle != IntPtr.Zero)
                        {
                            return(handle);
                        }
                    }
                }
            }

            _unloadableNativeLibs.Add(name);

            return(IntPtr.Zero);
        }
예제 #2
0
        public void GetProjectNativeLibPathReturnsCorrectPath()
        {
            var expected = Path.Combine("project", "runtimes", "win7-x86", "native");

            Assert.Equal(expected, NativeLibPathUtils.GetProjectNativeLibPath("project", "win7-x86"));
        }