Search code examples
c++cdllheaderonnx

C onnx header can't find OrtEnv definition


I am trying to wrap the ONNX header for use in another language. To be clear it uses the C dll and requires the C header however I'm having issues compiling using the C header due to the ONNX header seemingly missing the definition of the OrtEnv struct that is used in the current ONNX samples.

https://github.com/microsoft/onnxruntime/blob/master/include/onnxruntime/core/session/onnxruntime_c_api.h

This is the ONNX api header that I'm trying to use to wrap.

And the sample

https://github.com/microsoft/onnxruntime/blob/master/csharp/test/Microsoft.ML.OnnxRuntime.EndToEndTests.Capi/C_Api_Sample.cpp

On line 30 it declares a raw pointer to a struct I cannot find the definition of in the api header thenless I do not understand something.

Could someone possibly elaborate on what I am doing wrong? All I can see is method declarations returning OrtEnv but never the type declaration.

There is a complete dynamic package available here with the header:

https://github.com/microsoft/onnxruntime/releases/download/v1.4.0/onnxruntime-win-x64-gpu-1.4.0.zip

where it should be simple to link the dll to your application and include the aforementioned header that im having issues with.


Solution

  • If a header does not contain a definition, it means that the author did not want to give it to you. That can happen for various legitimate reasons, one of them is that you should not be able to tamper with the content.