Gets or sets a string value representing the path to the native library.
public static string LibraryPath { get; set; }
LibraryPath # get and set (Platform)
A value representing the native library path, as the following:
Platform | Native Library Path |
---|---|
Windows | LEADTOOLS\\Bin\\CDLL\\x64\\ |
Linux | LEADTOOLS/Bin/Lib/x64/ |
macOS | LEADTOOLS/Bin/Xcode/Frameworks/macOS/ |
using Leadtools;
private static string GetLibraryPath()
{
var currentDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string binFolderName = string.Empty;
var kernelName = string.Empty;
if (Platform.IsLinux)
{
binFolderName = Path.Combine("Lib", Platform.Is64Bit ? "x64" : "x86");
kernelName = "libltkrn.so";
}
else if (Platform.IsMacOS)
{
binFolderName = "Xcode/Frameworks/macOS/";
kernelName = "Leadtools.framework";
}
else
{
binFolderName = Path.Combine("CDLL", Platform.Is64Bit ? "x64" : "Win32");
kernelName = Platform.Is64Bit ? "LtKrnx.dll" : "LtKrnu.dll";
}
const int levels = 10;
for (var i = 0; i < levels; i++)
{
currentDir = Path.Combine(currentDir, "..");
var path = Path.GetFullPath(Path.Combine(currentDir, "Bin", binFolderName, kernelName));
if (Platform.IsMacOS && Directory.Exists(path) || File.Exists(path))
return Path.GetDirectoryName(path);
}
throw new DllNotFoundException(kernelName);
}
public static void InitRuntime(string path)
{
if (string.IsNullOrEmpty(path))
Platform.LibraryPath = Path.GetFullPath(GetLibraryPath());
else
Platform.LibraryPath = path;
}
Platform Class
Platform Members
Leadtools Namespace
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document