Support for Xamarin.iOS
clooudch opened this issue · comments
Hi
I attempted to use this library in a Xamarin.iOS and received the following exception:
System.DllNotFoundException: lmdb assembly:<unknown assembly> type:<unknown type> member:(null)
at (wrapper managed-to-native) LightningDB.Native.Lmdb.mdb_env_create(intptr&)
at LightningDB.LightningEnvironment..ctor (System.String path, LightningDB.EnvironmentConfiguration configuration) [0x00030] in <83a69e57559a4104865e28c7fe2fd683>:0
at TestApp.AppDelegate.FinishedLaunching (UIKit.UIApplication application, Foundation.NSDictionary launchOptions) [0x00001] in C:\test\TestApp\AppDelegate.cs:24
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.Type principalClass, System.Type delegateClass) [0x00047] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:79
at TestApp.Application.Main (System.String[] args) [0x00001] in C:\test\TestApp\Main.cs:12
That's probably because there is no native library for Xamarin.iOS available in the nuget package or it does not get copied. At least in theory it should be possible to support Xamarin.iOS as lmdb supports iOS as well. I would like to get this work and any help is welcome as I am not very experienced in this field.
Regards
Claudio
I don't use Xamarin myself, so on this one I would be happy to take a pull request if someone would be willing to continue helping support it occasionally.
We need to get Lightning.NET running on both Android and iOS, as well as MacOS and Linux.
I've been creating VFile, a no-SQL, object oriented database that can save and load C# class objects -- including nested arrays, lists, dictionaries etc. I'm developing VFile from the codebase previously developed for Siaqodb https://github.com/morecraf/Siaqodb
which uses a prior version of LMDB.
There is a great need for a fast memory-based database like this for cross-platform applications developed using WinUI 3 combined with Uno Platform. This is the most important development story underway today for many reasons.
To learn more see my website: https://WinUI3.org
So I hope someone with the right skillset can port LMDB (Lightning.NET) to both Xamarin.iOS and Xamarin.Android.
A quick look says that this should be able to work since LMDB seems to be able to target android and OSX. but it is going to take some time and experimentation. I can try to experiment with this, but I've never used Xamarin and I have no idea how long it might take me to figure it all out. If you need this in the short term we would appreciate any help you could provide.
The library already works fine on OSX, it's what I primarily use when contributing. Aside from providing the binaries, I believe the library should already work on the platforms mentioned. It targets netstandard2.0. There is nothing stopping you from building your own native lmdb binaries and trying out now. Have you tried and it hasn't worked?
If someone can provide additions or feedback on #157
Specifically which runtimes are needed and which cross compile options or toolsets used to produce the necessary binaries you're looking for. It shouldn't be hard but to @AlgorithmsAreCool 's point it would be easier for those that already working in these ecosystems to contribute. The ramp up to familiarize with what's needed, as well as the longer term support can be challenging if we're not using them ourselves.
Feedback on #161 would be greatly appreciated. I've added the Android binaries and will start to work on the iOS binaries next.
The iOS binaries were just pushed as well.
@clooudch @MarkBrainfire I've published nuget version 0.16.0-preview.1 with the binaries from the open PR. Hopefully this helps others working in these ecosystems test the binaries before I merge in the PR.
I haven't heard a single response either confirming or acknowledging an issue. I would say at this point it's either working, or nobody cares so I'll close out the pull request and merge the binaries in. If someone notices an issue they can reopen or open a new issue.