// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Experimental C API consumer header. // // This header provides C function pointer typedefs and name constants for experimental ORT API functions, as well as // any auxiliary declarations required by the experimental API functions. // // The function pointer typedefs and name constants should be used together with the experimental API lookup function // `OrtApi::GetExperimentalFunction()`. A function's availability should always be checked at runtime (the lookup // returns nullptr if the function is not present). // // C++ API consumers should use the companion header, onnxruntime_experimental_cxx_api.h, which provides typed // accessors for the experimental API functions. // // IMPORTANT: Experimental functions are NOT part of the stable ABI. They may be added, changed, or removed between // releases without notice. Anything in this file should be treated as experimental and unstable. // // C usage: // OrtExperimental_OrtApi_ExperimentalApiTest_SinceV28_Fn fn = // (OrtExperimental_OrtApi_ExperimentalApiTest_SinceV28_Fn)api->GetExperimentalFunction( // kOrtExperimental_OrtApi_ExperimentalApiTest_SinceV28_FnName); // if (fn) { // OrtStatusPtr status = fn(&result); // } // // C++ usage (see onnxruntime_experimental_cxx_api.h): // if (auto* fn = Ort::Experimental::Get_OrtApi_ExperimentalApiTest_SinceV28_Fn(api)) { // Ort::Status status(fn(&result)); // } #pragma once #include "onnxruntime_c_api.h" // // Auxiliary declarations // // Declarations of auxiliary types or typedefs required by experimental APIs go here. // // For example, if an experimental API uses a new type, OrtExperimentalType, we would declare it in this file: // ORT_RUNTIME_CLASS(ExperimentalType); // // // C function pointer typedefs and name constants // // For each ORT_EXPERIMENTAL_API(VER, RET, NAME, ...) entry in the .inc file, this generates: // // // Function pointer typedef: // typedef RET(ORT_API_CALL* OrtExperimental__SinceV_Fn)(...) NO_EXCEPTION; // // // Name constant for lookup: // static const char* const kOrtExperimental__SinceV_FnName = "_SinceV"; // // Example: ORT_EXPERIMENTAL_API(28, OrtStatusPtr, OrtApi_ExperimentalApiTest, _Out_ int64_t* out) produces: // typedef OrtStatusPtr(ORT_API_CALL* OrtExperimental_OrtApi_ExperimentalApiTest_SinceV28_Fn)( // _Out_ int64_t* out) NO_EXCEPTION; // static const char* const kOrtExperimental_OrtApi_ExperimentalApiTest_SinceV28_FnName = // "OrtApi_ExperimentalApiTest_SinceV28"; #define ORT_EXPERIMENTAL_API(VER, RET, NAME, ...) \ typedef RET(ORT_API_CALL* OrtExperimental_##NAME##_SinceV##VER##_Fn)(__VA_ARGS__) NO_EXCEPTION; \ static const char* const kOrtExperimental_##NAME##_SinceV##VER##_FnName = #NAME "_SinceV" #VER; #include "onnxruntime_experimental_c_api.inc" #undef ORT_EXPERIMENTAL_API