.Net Maui use DLL on every platform


I’m building a Keygenerator application with .Net Maui (not blazor).

For this i use c#-Code in the MainPage.xaml.cs that calls a cpp .dll file and imports some methods.

The import looks like this:

    [DllImport("W5R._Keygen.dll", CallingConvention = CallingConvention.StdCall)]
    internal unsafe static extern void
    SHA256_calc(byte* hash, void* input, ulong inputlen);

The .dll is in the same folder as the MainPage.xaml, App.xaml etc.

By changing some properties of the .dll (Build = content) the Debug version on the Windows Machine works fine and it works exactly as it should.

and this is the problem:

when I run the application on the android-emulator it loads the app just fine and as soon as i press a button that invokes the usage of the .dll my App Crashes and it just stopped working.

Beforehand I had the error ".system dll not found" which i fail to reproduce in the current moment.

Anyone knows how I use the .dll library? It’s cpp code that i cannot access.


You can’t use a dll on Linux / Android.
Dll are a windows thing and Linux has other formats for shared libraries.

see this Post

It seems there exists a wine release for Android, but I don’t know how its used.

Answered By – rxDietel

Answer Checked By – Marie Seifert (FlutterFixes Admin)

Leave a Reply

Your email address will not be published.