From 2c74766ad17214d1c2de0d5769a1809f4cd5b419 Mon Sep 17 00:00:00 2001 From: Paul McDaniel Date: Wed, 22 Apr 2020 11:24:36 -0700 Subject: [PATCH] Add new docs around how to bind to the onnxruntime.dll (#3539) --- docs/C_API.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/C_API.md b/docs/C_API.md index c8671cdf4d..b6e078d1ec 100644 --- a/docs/C_API.md +++ b/docs/C_API.md @@ -39,5 +39,18 @@ The example below shows a sample run using the SqueezeNet model from ONNX model * [../csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp](../csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp) +## Deployment + +### Windows 10 + +Your installer should put the onnxruntime.dll into the same folder as your application. Your application can either use [load-time dynamic linking](https://docs.microsoft.com/en-us/windows/win32/dlls/using-load-time-dynamic-linking) or [run-time dynamic linking](https://docs.microsoft.com/en-us/windows/win32/dlls/using-run-time-dynamic-linking) to bind to the dll. + +#### Dynamic Link Library Search Order + +This is an important article on how Windows finds supporting dlls: [Dynamic Link Library Search Order](https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order). + +There are some cases where the app is not directly consuming the onnxruntime but instead calling into a DLL that is consuming the onnxruntime. People building these DLLs that consume the onnxruntime need to take care about folder structures. Do not modify the system %path% variable to add your folders. This can conflict with other software on the machine that is also using the onnxruntme. Instead place your DLL and the onnxruntime DLL in the same folder and use [run-time dynamic linking](https://docs.microsoft.com/en-us/windows/win32/dlls/using-run-time-dynamic-linking) to bind explicity to that copy. You can use code like this sample does in [GetModulePath()](https://github.com/microsoft/Windows-Machine-Learning/blob/master/Samples/SampleSharedLib/SampleSharedLib/FileHelper.cpp) to find out what folder your dll is loaded from. + ## Telemetry + To turn on/off telemetry collection on official Windows builds, please use Enable/DisableTelemetryEvents() in the C API. See the [Privacy](./Privacy.md) page for more information on telemetry collection and Microsoft's privacy policy.