-
Notifications
You must be signed in to change notification settings - Fork 319
Implement GetTestMessage in CppConsoleDll using Ort::Env initialization #623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,10 +5,57 @@ | |||||||
| #include <windows.h> | ||||||||
| #include <combaseapi.h> | ||||||||
| #include <cstring> | ||||||||
| #include <string> | ||||||||
|
|
||||||||
| // Include ONNX Runtime headers from WindowsAppSDK.ML package | ||||||||
| #include <winml/onnxruntime_cxx_api.h> | ||||||||
|
|
||||||||
| // Initializes an ORT environment to verify the WindowsML runtime is operational. | ||||||||
| // Returns a success message if the runtime loads correctly. | ||||||||
| extern "C" __declspec(dllexport) char* GetTestMessage() | ||||||||
|
||||||||
| extern "C" __declspec(dllexport) char* GetTestMessage() | |
| extern "C" char* GetTestMessage() |
Copilot
AI
Apr 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ort::Env env(...) is never referenced after construction. With /W4 and TreatWarningAsError enabled for this project, this is likely to trigger an "unreferenced local variable" warning and fail the build. Either explicitly mark it as used (e.g., cast to void) or restructure the code so the env object is actually referenced.
| Ort::Env env(ORT_LOGGING_LEVEL_WARNING, "DllTest"); | |
| Ort::Env env(ORT_LOGGING_LEVEL_WARNING, "DllTest"); | |
| (void)env; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DLL exports are declared/defined with the default calling convention (i.e., __cdecl), but the client casts them to __stdcall function pointers. That mismatch is harmless on x64/ARM64 but will cause stack corruption if an x86 configuration is ever added. Align the calling convention by either removing __stdcall from the typedefs or explicitly exporting the functions with a matching convention (and reflecting that in the header).