.NET Core/5/6/7/8 API

Article: dts0241

Applies to: dtSearch Engine

Information about the dtSearch .NET Core/5/6/7/8 API

The dtSearch Engine has two .NET APIs, one for the older .NET Framework (.NET 4.x), and one for the newer versions, .NET 5, and later. The newer API is based on the .NET Standard 2.0 specification and is described in the documentation as the ".NET Standard API" although in practice it will generally be used for .NET 5 and later.

Both APIs rely on the dtSearch Engine native library and an API wrapper. The older .NET Framework 4.x API requires dtSearchNetApi4.dll (the API wrapper) and dtengine64.dll (the native library). The .NET Standard API relies on dtSearchNetStdApi.dll (the API wrapper) and dtSearchEngine.dll (the Windows native library), libdtSearchEngine.so (the Linux native library), or libdtSearchEngine.dylib (the macOS native library).

API documentation for the .NET Standard API is posted here: dtSearch .NET API Documentation. Sample code is included with the dtSearch Engine versions 7.90 and later. Additionally, an ASP.NET Core demo showing faceted search and multicolor hit-highlighting is available here. Please select "SEC Filings" to see the faceted search portion of the demo. An article describing the demo's sample code is available here: Developer Tutorials.

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. The macOS SDK includes the macOS version of the .NET Standard API.

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 compatibility 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

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 Windows, Linux, and macOS 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.

Why is the name of the native library used with the .NET Standard API different from the older 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. The same binary file runs in Windows, Linux, and MacOS.

P/Invoke does not have a fully cross-platform 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 it is libdtSearchEngine.so, and under MacOS it is libdtSearchEngine.dylib. All of the different dtSearchEngine native libraries are installed under the dtSearch engine\lib folder in subfolders organized by platform and CPU. (There is a way to vary the native library by platform, SetDllImportResolver, but it is only supported in a subset of the environments where .NET Standard 2.0 applies.)