You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it currently possible to do run time loading of native modules in .Net Core? I know it's possible to use [DllImport], but I can't seem to find anything that would allow one to load a native Dll or Library at runtime.
I've run into a few scenarios where I want to detect at runtime if a native api is present and then be able to load support for that api on the fly as needed, if it's present. I.e. GitLib2 and enabling git support in my application if Git is present.
I think it would incredibly handy for game libraries as well, pinvoking into vulkan at runtime and or being able to switch to a directx wrapper on windows at runtime.
I've deduced how this can be built now, but I wanted to inquire if it exists now or is on the road map?
To build it now, I would imagine using [DllImport] to LoadLibrary on windows and dlOpen on Linux and using conditional compilation to build separate os specific versions of the ""Loader"" and then targetting the nuget package for deployment with specific assemblies per environment. On linux calls to "XYZLoader.Loader" would use DLOpen etc, and on windows it would use LoadLibrary.
The text was updated successfully, but these errors were encountered:
Thanks, exactly the information I was looking for, huge help. The prototype implementation is pretty close to what I was envisioning, I'll use/tweak that for now until it eventually makes it's way to the framework.
Dynamic DLL Import - Runtime PInvoke
Is it currently possible to do run time loading of native modules in .Net Core? I know it's possible to use [DllImport], but I can't seem to find anything that would allow one to load a native Dll or Library at runtime.
I've run into a few scenarios where I want to detect at runtime if a native api is present and then be able to load support for that api on the fly as needed, if it's present. I.e. GitLib2 and enabling git support in my application if Git is present.
I think it would incredibly handy for game libraries as well, pinvoking into vulkan at runtime and or being able to switch to a directx wrapper on windows at runtime.
I've deduced how this can be built now, but I wanted to inquire if it exists now or is on the road map?
To build it now, I would imagine using [DllImport] to LoadLibrary on windows and dlOpen on Linux and using conditional compilation to build separate os specific versions of the ""Loader"" and then targetting the nuget package for deployment with specific assemblies per environment. On linux calls to "XYZLoader.Loader" would use DLOpen etc, and on windows it would use LoadLibrary.
The text was updated successfully, but these errors were encountered: