java-native-interface

Blackberry 10: Android Runtime & JNI

≯℡__Kan透↙ 提交于 2020-02-21 11:55:47
问题 Is JNI supported on the BlackBerry 10 Android Runtime? I would like to execute native c code in my android app which I'd like to deploy on the blackberry 10 os. In my android app, I use JNI to handle callbacks from the native c code to the java code. Is this supported on the bb10 android runtime? 回答1: All I could find is this thread: Any plans for supporting Android Native Code which doesn't appear to have an official response. My guess is that 'no' Android NDK won't be supported as

Integrating log4j with SWIG/JNI?

房东的猫 提交于 2020-02-06 04:43:34
问题 I'm working on a Java program which has a C++ module. I'd like for my C++'s stdout/stderr to be sent to a slf4j/log4j logger. Some possibilities: Have my C++ module capture stdout/stderr in a string which is returned and sent to a logger. A downside is the C++ module might be expensive and this would be asynchronous. Have my Java software create/manage a temp file to which the C++ module can write. Upon completion, my software would read and then delete the file and send the data to slf4j. is

Winapi - SetWindowLongPtr in ShutdownBlockReasonCreate / Destroy implementation of JNI native code

丶灬走出姿态 提交于 2020-02-05 02:35:11
问题 I'm currently working on a Java project involving Eclipse RCP using SWT and was trying to handle graceful shutdown by providing meaningful messages to user in Windows environment when saving. I was supposed to use ShutdownBlockReasonCreate and ShutdownBLockReasonDestroy APIs to achieve this but after some research I had to implement them in C++ native code which I'm very new to. As they are not available in JNA and Eclipse SWT does not provide such capability off-the-shelf (would love to know

Undefined reference error, can not create shared library

▼魔方 西西 提交于 2020-02-03 08:47:47
问题 Tried so many ways to solve problem but no luck. Here is my Android.mk: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := avcodec LOCAL_SRC_FILES :=libavcodec.a include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := avutil LOCAL_SRC_FILES :=libavutil.a include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := swscale LOCAL_SRC_FILES :=libswscale.a include $(PREBUILT_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := avformat LOCAL_SRC_FILES

4-byte wchar_t to String conversion using JNI

心不动则不痛 提交于 2020-02-02 13:12:53
问题 so I have this CanvasView which shows debugging information of my app. Its basically overlayed view with transparant background so everything drawn in the canvas is floating in the screen. Since I need some information from native c++ which returns wchar_t*, how can I use env->NewString since android now makes wchar_t is 4 bytes while jchar is 2 bytes? My java code that calls native c++ function in my lib: private static String get_Name(); private class CanvasView extends View{ public

JNI Bus error after moving object creation to another method

眉间皱痕 提交于 2020-02-02 03:47:24
问题 I have a problem with JNI that has taken me all day and will probably drive me insane if I don't call for help. In two phrases : I call a NewObject from a JNI method and it works fine, but when I moved this code to another method, it crashes. More details: I have this simple class, and I want to create instances of it from the JNI C/C++ code: package example; public class ModelDetails { public ModelDetails() { ... } } The class with the native method is as follows: package example; public

Can a finalizer be called on an object that is in the middle of a (native) call?

混江龙づ霸主 提交于 2020-02-01 09:17:07
问题 We're seeing a weird AddressSanitizer (clang/C++) "heap-use-after-free" violation that might relate to a finalizer corner case. Let's say, a Java object OBJ has a handle to to a native resource X. A thread that created OBJ before, is now making a call on OBJ.method(), which calls into a (static) native method staticMethod(X), in which X is used. Now, at more or less the same time, we're seeing a thread deleting the native resource X. We strongly assume that this triggered by the finalizer

Can a finalizer be called on an object that is in the middle of a (native) call?

萝らか妹 提交于 2020-02-01 09:16:02
问题 We're seeing a weird AddressSanitizer (clang/C++) "heap-use-after-free" violation that might relate to a finalizer corner case. Let's say, a Java object OBJ has a handle to to a native resource X. A thread that created OBJ before, is now making a call on OBJ.method(), which calls into a (static) native method staticMethod(X), in which X is used. Now, at more or less the same time, we're seeing a thread deleting the native resource X. We strongly assume that this triggered by the finalizer

Understanding Jeprofile output

倖福魔咒の 提交于 2020-01-30 11:23:57
问题 I was able to generate the Jeprofile output as follows based on the descriptions present here jemalloc post Please find the jemalloc output and the graph. > Using local file /bin/java. Using local file jeprof.57473.0.f.heap. > Total: 79372091 B 78084060 98.4% 98.4% 78084060 98.4% > je_prof_backtrace 1288031 1.6% 100.0% 1474342 1.9% > Java_java_util_zip_ZipFile_getZipMessage > 0 0.0% 100.0% 6889972 8.7% 0x00007f3d5ebac3e6 > 0 0.0% 100.0% 270421 0.3% 0x00007f3d5ebb8a79 > 0 0.0% 100.0% 727762 0

“Unsatisfied native code filter” when exporting OSGi bundle containing native Android lib

风格不统一 提交于 2020-01-25 03:34:24
问题 I try to create an OSGi bundle using native C/C++ code for deployment on an Android device running Felix. I was able to compile the native code and link it to a shared object using the Android NDK arm-linux-androideabi toolchain. Now, I try to export the OSGi bundle to a .jar file using eclipse PDE (Export->Deployable plug-ins and fragments). This fails. The error-window popping up tells me: 'Export Plug-ins' has encountered a problem. Processing inclusion from feature org.eclipse.pde