Reputation:
While working with some sources written in C++ I found those macro:
JNIEXPORT return_type JNICALL function_name(...) { However, Android NDK samples don't use them. I read some docs from Oracle, but I'm still confused.
Do I necessarily have to use them while working with Android NDK?
One of the reasons for asking - those macro break syntax highlighting in eclipse CDT :)
Upvotes: 7
Views: 8681
Reputation: 2221
Check that the include path of the platform you desire from the Android NDK has been added to your project's C\C++ includes. This can be done as follows:
Upvotes: 1
Reputation: 2524
Basically is a windows issue, if you have a look to the file jni_md_win32.h that comes with oracle Java jdk this is the macro definition:
/*
* @(#)jni_md.h 1.14 03/12/19
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
#ifndef _JAVASOFT_JNI_MD_H_
#define _JAVASOFT_JNI_MD_H_
#define JNIEXPORT __declspec(dllexport)
#define JNIIMPORT __declspec(dllimport)
#define JNICALL __stdcall
typedef long jint;
typedef __int64 jlong;
typedef signed char jbyte;
#endif /* !_JAVASOFT_JNI_MD_H_ */
In the header jni_md_linux.h those macros are empty. So I guess that as long you don't want your native code to be executed in windows with oracle JVM you can remove those macros.
Upvotes: 12