JNIEXPORT和JNICALL在Android的NDK [英] JNIEXPORT and JNICALL in Android NDK

查看:602
本文介绍了JNIEXPORT和JNICALL在Android的NDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然对某些信号源用C ++的工作,我发现那些宏:

While working with some sources written in c++ I found those macro:

JNIEXPORT return_type JNICALL function_name(...){

然而,Android的NDK样本不使用它们。我读了Oracle的一些文件,但我仍然感到困惑。 难道我一定要使用他们,而与Android NDK的工作?

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?

其中一个原因要求 - 这些宏观突破语法高亮显示在Eclipse CDT的:)

推荐答案

基本上是一个Windows的问题,如果你看看随附甲骨文的Java JDK,这是宏定义文件jni_md_win32.h:

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_ */

在jni_md_linux.h这些宏是空的头。所以我想,只要你不希望你的本地code在Windows与Oracle JVM可以删除这些宏被执行。

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.

这篇关于JNIEXPORT和JNICALL在Android的NDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆