Question: How can the recently added liblmdb.wasm be used for SiaqoDB/LightningDB on Uno Platform/WebAssembly?
Hi Corey,
First, thanks for all your work on LightningDB! I’m building a cross-platform object database (VFile, a fork of SiaqoDB) and am thrilled to have robust support for desktop and Android, with iOS in the pipeline.
I noticed that the latest releases now include a liblmdb.wasm binary under runtimes/browser-wasm/native/. I’d love to understand:
Is this file meant to enable direct LMDB use in .NET WASM scenarios (e.g., Uno Platform, Blazor, or MAUI for Web)?
Is there currently a supported way to P/Invoke into liblmdb.wasm from C#, or is some form of JavaScript glue/interop required?
If it’s experimental or requires additional wiring, do you have any tips, sample code, or guidance on integrating LMDB in a browser/WebAssembly context—especially for SiaqoDB or object storage scenarios?
Are there plans (or technical blockers) for true “drop-in” WASM support, similar to the experience on desktop and mobile?
Any insight would be greatly appreciated! If there are other approaches you’d recommend for object database persistence in Uno Platform WASM, I’d love to hear them.
Thanks again for your work and for making LightningDB such a great cross-platform foundation!
—Mark
I originally compiled it for early exploration. However, I have since gotten a fully functional version of wasm to work for my other project kotlin-lmdb. It was necessary for an app I'm building for Compose Multiplatform. It required a lot of trial and error, but in the end it works pretty seamlessly. Only two substantial differences is that it required a specific environment option as memory mapped files don't work in emscripten yet, and that you need to mount the filesystem before interacting with the library. In the case of NodeJS it uses the normal node / OS filesystem, but in the browser the filesystem uses IndexDB under the covers although I think this may change with time. It was necessary for me to export js files that call into the wasm module, think of it like the equivalent of the pinvoke method calls, but the emscripten compiler creates it for you. I also needed to export the file io methods, memory management, etc. for it to work.
I honestly don't know if the same items are required or not for Blazor, but my original intention was that it could be useful in that context as well. For example, if Blazor already compiles in support for file io then it might work as-is (assuming the pinvoke is supported). This will likely require you trying it out and reporting back some directional findings. I don't have a near-term need for blazor myself, so without a little help I'm unlikely to prioritize it in the near-term.
Thanks Corey! Good info. I may attempt to get this working for Uno Platform down the line.