-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Support building shared libraries targeting Linux #5
Comments
Just to be sure I understand correctly, right now it's not possible to create a library for Android? I'd like to write a method which takes an instance of a android.view.View for example, something like this:
|
It works now. I don't know why I left this open. See the DynamicLibrary sample under samples in this repo. |
@MichalStrehovsky I'm confused. But how do I reference a class from Android? I.e. android.view.View |
If you want that, you should use Xamarin or MAUI. Bflat will only let you build libraries that don't have luxury access to the Java world. You would use the library like this: https://github.com/android/ndk-samples/tree/main/hello-jni |
Thanks for reply. I was looking for a way other than Xamarin due to performance reasons. |
Now is v8.0.1。I just call C# dll from android (arm64) Activity ! (greate work bflat ! and jna !) 🤙 👍 🥰 (no need NDK !) @MichalStrehovsky @opcodewriter here is my progress:
class LIB
{
[System.Runtime.InteropServices.UnmanagedCallersOnly(EntryPoint = "addx")]
static int MainExport(int a, int b)
{
System.Console.WriteLine("MainExport C#");
return a + b;
}
}
bflat build -o:./output/liblinux-arm64.dll --arch:arm64 --os:linux --libc:bionic
sourceSets {
main.jniLibs.srcDirs = ['libs']
}
package com.example.myapplication;
import com.sun.jna.Library;
import com.sun.jna.Native;
public interface MyLibraryx extends Library {
MyLibraryx INSTANCE = Native.load("linux-arm64-dll", MyLibraryx.class);
int addx(int a, int b);
} I haven't explored other things yet (string\float\function pointer \ load opengl libray ..... more ) But I can't wait to tell you all ! |
Shared libraries can only be created for Windows right now.
The text was updated successfully, but these errors were encountered: