AaronRobinsonMSFT / DNNE

Prototype native exports for a .NET Assembly.
MIT License
406 stars 41 forks source link

The `preload_runtime()` method should return an error code or bool value #108

Closed AaronRobinsonMSFT closed 2 years ago

AaronRobinsonMSFT commented 2 years ago

There is no present way to preload the runtime without an abort being called in the process. This is related to https://github.com/AaronRobinsonMSFT/DNNE/pull/99. Ideally the preload_runtime() should be updated to return an indication if the runtime failed to load and let the application proceed normally.

https://github.com/AaronRobinsonMSFT/DNNE/blob/539f1c68b7d8c59b3dcbd1831da5a06a0d5b2ed2/src/platform/platform.c#L474

Note that this would not impact the scenario where a user directly calls an export and expects the system to lazily load the runtime.

rlcomstock commented 2 years ago

We could introduce a new preload_runtime_check(void) function that calls into prepare_runtime with a bool that tells it if it should abort or return true/false. That would make the same behavior for the normal call, but change it so a precheck can be made that doesn't abort/assert.

We could also return an error code. Which might just be simple and elegant. I am open for either solution.