build JNI C code fail ???

by Keroro » Mon, 27 Apr 2009 16:23:49 GMT


Sponsored Links
 Why build error?

build and Error Message:
.../mydroid$ make libmax
target thumb C: libmax <= development/max/max.c
development/max/max.c: In function 'Java_testdll_set':
development/max/max.c:7: error: parameter name omitted
development/max/max.c:7: error: parameter name omitted
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/
libmax_intermediates/max.o] Error 1

code as follows:

max.c
=======================================================================
#include <jni.h>
JNIEXPORT void JNICALL Java_testdll_set (JNIEnv *, jclass, jint);

 int i = 0;

    JNIEXPORT void JNICALL Java_testdll_set (JNIEnv *, jclass, jint
j)
      {
       i = j;
      }
=======================================================================

Android.mk
================================
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \

    max.c

LOCAL_C_INCLUDES := \

    $(JNI_H_INCLUDE)

LOCAL_SHARED_LIBRARIES := \

    libutils

LOCAL_PRELINK_MODULE := false

LOCAL_MODULE := libmax

include $(BUILD_SHARED_LIBRARY)
==================================

--~--~---------~--~----~------------~-------~--~----~



build JNI C code fail ???

by Keroro » Mon, 27 Apr 2009 16:34:48 GMT


 build JNI C code fail ???

Why build error?

build and Error Message:
.../mydroid$ make libmax
target thumb C: libmax <= development/max/max.c
development/max/max.c: In function 'Java_testdll_set':
development/max/max.c:7: error: parameter name omitted
development/max/max.c:7: error: parameter name omitted
make: *** [out/target/product/generic/obj/SHARED_LIBRARIES/
libmax_intermediates/max.o] Error 1

code as follows:

max.c
=======================================================================
#include <jni.h>
JNIEXPORT void JNICALL Java_testdll_set (JNIEnv *, jclass, jint);

 int i = 0;

    JNIEXPORT void JNICALL Java_testdll_set (JNIEnv *, jclass, jint
j)
      {
       i = j;
      }
=======================================================================

Android.mk
================================
LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \

    max.c

LOCAL_C_INCLUDES := \

    $(JNI_H_INCLUDE)

LOCAL_SHARED_LIBRARIES := \

    libutils

LOCAL_PRELINK_MODULE := false

LOCAL_MODULE := libmax

include $(BUILD_SHARED_LIBRARY)
==================================

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


build JNI C code fail ???

by MrSnowflake » Mon, 27 Apr 2009 19:58:33 GMT


 Probably because JNI is not supported.



--~--~---------~--~----~------------~-------~--~----~



build JNI C code fail ???

by Michael MacDonald » Mon, 27 Apr 2009 23:32:03 GMT


 


You need to supply variable names for all your function parameters, not
just jinit j.




--~--~---------~--~----~------------~-------~--~----~



build JNI C code fail ???

by Keroro » Tue, 28 Apr 2009 20:42:52 GMT


 Thank you, have been solution.

On 47 119 Michael MacDonald <googlec...@antlersoft.com>




--~--~---------~--~----~------------~-------~--~----~