-
Notifications
You must be signed in to change notification settings - Fork 33
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
Interop with Native Client library on MacOS and Linux #75
Comments
There is also some custom logic that try to detect if the I'm not sure if the best approach is to check for all possible library extensions for all platforms, or not... It would be nice to still be able to specify the full path to a specific file. |
According to my previous findings, the easiest way is to:
Note, that using Combination of DllImport("fdb_c") and disabling path-based library preloading, seems to address the majority of the library use cases. Maybe it is worth making this the default behavior, leaving the option to invoke custom loading on edge cases? Although I'm not sure if this would be a breaking change for many users. |
There was an issue specific to the way FoundationDB release the client as part of its setup, and the way path are resolved on Windows. I remember discussing with the devs and the best compromise was the current solution, but it is windows only. I think the compromise would be to check the platform at runtime, and keep the current behavior for Windows, and do what's required on Linux. The issue was that the fdb_c.dll was not in the current working directory, and was in one of the path declared in the I don't know what is the semantics of a simple Since .NET Core is more recent, I suppose that the way they implement DllImport for linux/mac is aligned with the standard for these platforms, but I don't have any experience for this. I'll try to setup a .NET Core 2.X and VSCode build env on my mac tonight to test things out. |
As I understand, E.g. check out this merged PR into the .NET Core CLR: dotnet/coreclr#1248 |
The code seem to have some issues loading the fdb_c library on MacOS and Linux.
It looks like the code expects to run on Windows by default, and the static constructor of
FdbNative
will callUnmanagedLibrary.Load(...)
which uses WIN32 specific interop to pre-load the library (LoadLibrary
,FreeLibrary
)I think that there's been work done in .NET Core to implement cross-platform library loading support, so maybe we should use this instead? If there's a NuGet package or existing code somewhere that could be reused, we could make it so that it works out of the box on all platform without having to invoke any method at the start.
We may need to check the current platform at runtime to emulate, but I'd like to not have to resort to #if /#else if possible.
The text was updated successfully, but these errors were encountered: