GithubHelp home page GithubHelp logo

how get jni acces? about raylib-go HOT 9 CLOSED

MatejMagat305 avatar MatejMagat305 commented on June 26, 2024
how get jni acces?

from raylib-go.

Comments (9)

gen2brain avatar gen2brain commented on June 26, 2024

No idea, but it is not related in any way to raylib, sorry. This is not the best place for questions and discussions, it is for issues with raylib-go.

from raylib-go.

gen2brain avatar gen2brain commented on June 26, 2024

Why even try to use something like purego on Android, how is it going to find the library there? Does it even support Android? You anyway need C for shared library so why not just use C?

from raylib-go.

gen2brain avatar gen2brain commented on June 26, 2024

I just looked at this, and still am not sure what you are trying to do here. JNI is used to access Java from C, of C from Java, you don't even have Java here. You just should use C, i.e. include headers you need, call what you want, and link with that library. How is JNI even related to this?

from raylib-go.

MatejMagat305 avatar MatejMagat305 commented on June 26, 2024

well, sometime I need jni to call something extra ...,

I was able to run my OpenCL purego wrapper on termux(android enviroment), so I would like to try in apk ...

So my question is whether is android_app *GetAndroidApp(); available outside internal library

from raylib-go.

gen2brain avatar gen2brain commented on June 26, 2024

You can see for yourself that it is not exposed.
So how is your example related to JNI then? I still don't understand why you even go with all that trouble with purego, just use cgo, link the library, and put the library in android/libs, what do jni and purego have to do with that? There is nothing to gain here, you must use C anyway.

from raylib-go.

MatejMagat305 avatar MatejMagat305 commented on June 26, 2024

so, purego is primary to avoid cgo, but it is also good to avoid complicate link with headers ..., so if I (in my wrapper) create var somename func(...); porego.RegisterFunc(handle, "...", &somename) I do not have to write other version for cgo version, it will work even in cgo (yes, if you have cgo which has good link, it is useless, because cgo is litle bit faster, but if c headers in f.e. in android is coplicate purego still can be usefull)

from raylib-go.

gen2brain avatar gen2brain commented on June 26, 2024

But you cannot avoid cgo if you want to compile library as c-shared. You must use it on Android no matter what else you are doing, so how do you avoid cgo?

from raylib-go.

gen2brain avatar gen2brain commented on June 26, 2024

In my experience, purego and cgo have exactly the same performance (i.e. I use it for some image decoders). And if I already must use cgo, I just really don't see a point to use experimental library that doesn't even work if function receives or returns a plain struct.

from raylib-go.

MatejMagat305 avatar MatejMagat305 commented on June 26, 2024

well, I was found

func HomeDir() string {

I am NOT trying avoid cgo in android, compile headers to android in Go is hard, so I was try use purego as "cheap wrapper" with many options of paths (androids are very variable with path shared lib) as I have in https://github.com/opencl-pure/pureCL/blob/9bd3c662ac677f6f25beb12282d1e267b5babade/purego_library_unix.go#L25
similar to https://github.com/krrishnarraj/libopencl-stub/blob/4a235674884fcb75886142dd4ce2f9aa08117037/src/libopencl.c#L82 ...

as I notice android libOpenCL.so is not public ..., so I was try copy to internal lib ...

from raylib-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.