All Questions
19
questions
0
votes
0
answers
918
views
"CallObjectMethod" in JNI-Callback returns NULL
I have a JNI-Interface between C++ and Java. I want to pass a callback function as a parameter in a function on java side. This will be called later in C ++ via JNI and should return me a string.
This ...
0
votes
0
answers
175
views
Implement callback function as interface in JNI and save reference in the function pointer
So basically I have such struct in the C++ side:
typedef int(*callback)(int, int);
typedef struct InfoCallback {
int a;
int b;
callback call;
} InfoCallback_t;
And I would very much ...
0
votes
0
answers
433
views
Jni - Call c++ method from java using void pointers
Is there any way to call a native (c++) method from java using the method's function pointer?
Basically i want to use this for callbacks. Once a certain event in java get's fired, i want java to call ...
1
vote
1
answer
3k
views
JNI callback to Java from c++ class crashing
I'm trying to call a Java function from a C++ class using JNI on Android. I have searched and searched but haven't found my exact case. I can call methods in my c++ library from Java, but am having ...
1
vote
1
answer
583
views
java.lang.UnsatisfiedLinkError when trying to follow an MIT example on SWIG usage of C++ callbacks
I am trying to implement a simple application which enables C++ to do callbacks into Java. To this, I found some examples written many years ago by some people at MIT: https://github.com/swig/swig/...
-2
votes
2
answers
254
views
C# language doesn't need the concept of delegates? [closed]
Thanks for your objectivity, especially where C# is your language of choice. Angry downvoters, I think I've asked a legitimate question here? Otherwise leave a constructive comment, please.
To the ...
2
votes
2
answers
1k
views
C++11 alternative to the Java anonymous callback class
I realise that the solution I have here is far from ideal with C++, so I'm asking what a proper C++ programmer would do in this situation. (C++11)
I have a DialogBox class, which stores a collection ...
1
vote
1
answer
3k
views
JNI callback passed to C
I have a java callback function I want to pass to a C++ wrapper that will in turn pass it to a C/C++ function.
How would I do this?
I imagine the wrapper has to create some type of C++ lambda ...
1
vote
2
answers
1k
views
How to implement a callback function that calls from Java to C++?
I have a native C++ application that creates a JVM via JNI, instantiates a Java class (an Akka Actor) and invokes asynchronous non-blocking functions on it. I do this using JNI in C++ see snippet ...
1
vote
2
answers
682
views
JNI: Callback from JVM to C++ fails to run
I start JVM from C++ program.
C++ code:
JNIEXPORT jobject JNICALL com_javelin_JavelinMarketData_callBackIntoNative(JNIEnv* env, jobject obj, jlong ptr)
{
std::cout << "...
2
votes
1
answer
2k
views
C++ binary to Java gets "java.lang.Error: Invalid memory access"
I have a Java library interfacing (via JNA) with a native C++ DLL. This DLL provides functions to set callbacks that are invoked when certain hardware events occur.
All of these callbacks work except ...
56
votes
1
answer
5k
views
Java thread leaks when calling back from native thread via JNI
Summary: I am seeing Java thread leaks when calling back into Java from native code on a natively-created thread.
(Update 11 Feb 2014: We raised this as a support request with Oracle. It has now been ...
0
votes
1
answer
483
views
Runtime error on JNI callback
I'm facing a fatal error when I make a JNI callback from native code:
SIGSEGV ..
Distribution: CentOS release 5.9 (Final), x64
Problematic frame:
V [libjvm.so+0x53499f] JNI_CreateJavaVM+0x20e6f
...
4
votes
1
answer
2k
views
Calling a c++ callback from Java invoked from C++ application via JNI
I have a C++ application that needs to interface with a Java library. I'd like to receive notifications from the Java side so it needs to call back into the C++ app. I've found numerous examples on ...
1
vote
1
answer
3k
views
Freeing JNI Array
I'm implementing a callback function in C++, but I'm facing some leak problems.
The implementation of array creation:
jshortArray convertShortArrayToJNI(JNIEnv* env, short* arr, size_t count) {
...