zeromq / zproject

CLASS Project Generator
Mozilla Public License 2.0
144 stars 104 forks source link

Problem: JNI binding generator can't handle function pointers as method parameters #776

Open bluca opened 7 years ago

bluca commented 7 years ago

https://github.com/zeromq/zproject/blob/master/zproject_java_lib.gsl#L156

        if resolve_container (argument) = 1
            my.method.okay = 0
            #echo "Skipping $(class.name).$(my.method.name) - can't deal with argument type $(argument.type)"

So the class is skipped given the constructor can't be generated.

This is a problem in CZMQ since it means that zactor bindings can't be generated. We'd need some help here from JNI experts! How can we fix this?

https://github.com/zeromq/czmq/issues/1443

jimrthy commented 7 years ago

It looks to me as though this is also a problem with ZLoop.

jimrthy commented 7 years ago

I'm not an expert in any of the tech involved here.

I think one valid approach would be:

I took a first pass at this approach (and started pointing out the places that look obviously broken) here: https://github.com/jimrthy/zproject/pull/1

I probably won't get another chance to look at this until next weekend, at the earliest.

Maybe someone who's more familiar with GSL can help push it further along?

sappo commented 7 years ago

Thanks for investigating I'll give it at try next week

jimrthy commented 7 years ago

Thank you!

sappo commented 7 years ago

@jimrthy I havn't forgotten this issue but I'm a bit short on time for time being.

jimrthy commented 7 years ago

I haven't forgotten either. Just also distracted by other things.

diorcety commented 6 years ago

Could you take a look on https://github.com/diorcety/zproject/tree/x_java2 ?

diorcety commented 6 years ago

python use ffi in order to handle the callbacks. I used jffi which is an Java implementation which allow to use java callback quickly. This is almost the same thing that python stuff

sappo commented 6 years ago

Neat, I'll have a look at it later, thanks

Am 12.02.2018 3:55 nachm. schrieb "Diorcet Yann" notifications@github.com:

python use ffi in order to handle the callbacks. I used jffi which is an Java implementation which allow to use java callback quickly. This is almost the same thing that python stuff

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zeromq/zproject/issues/776#issuecomment-364946330, or mute the thread https://github.com/notifications/unsubscribe-auth/AAeGuiJ5IfS-49StUlazgLunPsbrx5Xbks5tUFDlgaJpZM4LY7dS .

hgourvest commented 5 years ago

I managed to write a pure java class for zactor, and doing this I also discovered zsys::create_pipe was not working for the same reason, it pass a pointer to a handle.

stephan57160 commented 2 years ago

Found this link, but unable to see if really useful or not: https://stackoverflow.com/questions/819536/how-to-call-java-functions-from-c

(my 2 cents).