Why does ONNX use wstring for Windows and regular string for Linux? #21915
Unanswered
TannerCypret
asked this question in
API Q&A
Replies: 1 comment
-
Windows APIs historically used wchar_t for any file paths to support full unicode, so we made the library accept what windows natively uses. It hasn't been until recently that Windows supports UTF8 char_t strings, which was after Onnxruntime has already been in use for a while. That's why there are #ifdef settings around these functions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I tried to compile my C++ project in Linux which was previously working in Windows. It breaks due to the use of wstring for the ONNX model file path. After researching this I found some sources where people are just using include guards to use wstring for windows or just a string otherwise. Why does ONNX prefer wstring for windows instead of just using a string? Are include guards the intended way to make this work? This stack overflow is an example of using include guards around the file path string to allow for cross platform compatibility:
https://stackoverflow.com/questions/65379070/how-to-use-onnx-model-in-c-code-on-linux
Beta Was this translation helpful? Give feedback.
All reactions