You are here: dtSearch .NET Standard API > Native Libraries
Close
dtSearch .NET Standard API 2024.02
Native Libraries

The dtSearch .NET Standard API consists of two components, dtSearchNetStdApi.dll, which is cross-platform, and a platform-specific dynamic library). This article explains how to include the correct native library in your projects.

The dtSearch .NET Standard API consists of two components, dtSearchNetStdApi.dll, which is cross-platform, and a platform-specific dynamic library, dtSearchEngine.dll (Windows), libdtSearchEngine.so (Linux), or libdtSearchEngine.dylib (MacOS). 

dtSearchNetStdApi.dll is the same on all platforms except iOS, and uses PInvoke to call the native library. 

The native libraries are installed under the lib\engine folder under the dtSearch Engine folder, in folders organized by operating system (win, uwp, linux, macos). Each operating system folder contains a subfolder for each supported processor. The set of operating system folders present will depend on the dtSearch Engine versions that are installed. 

The dtSearch Engine for Windows includes the "win" and "uwp" folders under the dtSearch lib\engine folder.

How to add native libraries to a project

For most platforms, add a native library as follows: 

1. In Visual Studio, click "Add > Existing Item" in Visual Studio 

2. Select the correct dtSearchEngine library file from the folder tree under C:\Program Files (x86)\dtSearch Developer\lib\engine. For example, a 64-bit Windows application would use the dtSearchEngine.dll in the dtSearch lib\engine\win\x64 folder. A 64-bit Linux application would use libdtSearchEngine.so under the lib\engine\linux\x64 folder. 

3. Click the arrow next to "Add" to choose "Add as link" instead so the project will store a link to the file in the original location. 

4. After adding the library, right-click and select "Properties" 

5. Set the "Build Action" to "Content", and change the "Copy to Output Directory" setting to "Copy if newer".

Multi-platform projects

The Visual Studio GUI does not provide a way specify multiple native libraries to be conditionally included for different platforms. Instead, after adding one native library, you can edit the project file XML to use the MS Build Condition attribute to wrap separate entries for each build type. For example, the following XML conditionally includes 32-bit and 64-bit versions of the dtSearchEngine.dll for a UWP (Universal Windows Platform) project: 

 

<ItemGroup Condition=" '$(Platform)' == 'x64' "> <Content Include="..\..\..\..\lib\engine\uwp\x64\dtSearchEngine.dll"> <Link>dtSearchEngine.dll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup> <ItemGroup Condition=" '$(Platform)' == 'x86' "> <Content Include="..\..\..\..\lib\engine\uwp\x86\dtSearchEngine.dll"> <Link>dtSearchEngine.dll</Link> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> </ItemGroup>
Copyright (c) 1998-2023 dtSearch Corp. All rights reserved.