.NET Standard API

Last Reviewed: April 7, 2018

Article: DTS0241

Applies to: dtSearch Engine 7

Information about the dtSearch .NET Standard API

The dtSearch Engine has a new .NET Standard API similar to the current .NET API in dtSearchNetApi4.dll, but compatible with .NET Standard 2.0, .NET Core, and Xamarin.  

As with the current .NET API, the .NET Standard API relies on the dtSearch Engine native library (dtSearchEngine.dll under Windows, libdtSearchEngine.so under Linux, etc.).  Therefore, applications will need both the .NET Standard API wrapper, dtSearchNetStdApi.dll, and the native library for each platform.

API documentation is posted here.

The dtSearch Engine for Windows SDK includes the Windows and UWP versions of the .NET Standard API.  The dtSearch Engine for Linux SDK includes the Linux version of the NET Standard API.  For other platforms, please contact dtSearch.

What is .NET Standard?

.NET Standard is a common set of .NET APIs across all .NET platforms, including .NET Core, Xamarin, Mono, the .NET Framework for Windows, and UWP. For more information about .NET Standard, please see:

.NET Standard - Demystifying .NET Core and .NET Standard
https://msdn.microsoft.com/en-us/magazine/mt842506.aspx

Platform compatiblity matrix
https://docs.microsoft.com/en-us/dotnet/standard/net-standard

Is the dtSearch .NET Standard API supported on all platforms that are compatible with .NET Standard?

The dtSearch .NET Standard API requires both the .NET Standard API wrapper, dtSearchNetStdApi.dll, and a native library for the specific environment where it runs.  Therefore, it is only supported where the dtSearch Engine native library is available.

The native library versions currently available are:

              Windows - x86 and x86_64

              Windows UWP - x86 and x86_64

              Linux - 64-bit x86_64

              macOS - 64-bit x86_64

              Android - ARM  64-bit and x86_64 (beta)

              iOS - iphonesimulator and iphoneos (beta)

The following are currently only supported under Windows and Linux:

              External Language Analyzer API

              External File Parser API

              External Thesaurus API

              RAR archive support

How is the .NET Standard API licensed?

For each platform, the .NET Standard API is treated like other redistributable components for that platform.  

The Android, macOS, and iOS versions are licensed separately.

How does the .NET Standard API compare with the current .NET API in dtSearchNetApi4.dll?

The APIs are very similar but there are a small number of differences.  This article summarizes the changes: "Changes from dtSearchNetApi4.dll."

Another important difference is the type of DLL.  dtSearchNetApi4.dll is a mixed-mode DLL, which means that it has a 32-bit and a 64-bit version and requires certain MFC and CRT redistributables.  dtSearchNetStdApi.dll is a cross-platform library, so it does not depend on anything except .NET and is identical on all platforms except iOS.  (A separate iOS build is required due to differences in the iOS linking process.)

Why is the name of the native library used with the .NET Standard API different from the existing dtSearch Engine names?

The filename of the native library has to be the same on all platforms (except for the extension and the "lib" prefix used on Unix-based platforms), because of the way .NET Standard interfaces with native libraries.

dtSearchNetStdApi.dll uses P/Invoke to call the dtSearch Engine, and is identical on all platforms except iOS.  The same binary file runs in Windows, Linux, MacOS, and Android.

P/Invoke does not have a mechanism to vary the name of the native library called depending on the platform, so the name has to be "dtSearchEngine" on all platforms, except that the conventions for each platform for shared library names are used.  Therefore, under Windows the shared library is dtSearchEngine.dll, under Linux and Android it is libdtSearchEngine.so, and under MacOS it is libdtSearchEngine.dylib.  The iOS native library is a framework folder named dtSearchEngine_ios.framework.  All of the different dtSearchEngine native libraries are installed under the dtSearch engine\lib folder in subfolders organized by platform and CPU.