JNI-Test
2024-08-30 13:56:48
//testdll.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class testdll */
#ifndef _Included_testdll
#define _Included_testdll
#ifdef __cplusplus extern "C" {
#endif
/*
* Class: testdll
* Method: get
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_testdll_get(JNIEnv *, jclass);
/*
* Class: testdll
* Method: set
* Signature: (I)V
*/
JNIEXPORT void JNICALL Java_testdll_set(JNIEnv *, jclass, jint);
#ifdef __cplusplus
}
#endif
#endif
//testdll.java
public class testdll
{
static
{
System.loadLibrary("testdll");
}
public native static int get();
public native static void set(int i);
public static void main(String[] args)
{
testdll test = new testdll();
test.set(10);
System.out.println(test.get());
}
} gcc -Wl,--add-stdcall-alias -I "C:\Program Files\Java\jdk1.6.0_39\include" -I "C:\Program Files\Java\jdk1.6.0_39\include\win32" -shared -o testdll.dll testdll.cpp
//testdll.cpp
#include "testdll.h"
int i = 0;
JNIEXPORT jint JNICALL Java_testdll_get(JNIEnv *, jclass)
{
return i;
} JNIEXPORT void JNICALL Java_testdll_set(JNIEnv *, jclass, jint j)
{
i = j;
}
最新文章
- PHOG特征
- dynamics_cast<;>;
- [转]Try Cloud Messaging for Android
- Shortest Word Distance
- 使GridView可以单行横向滑动
- iOS获取汉字的拼音
- Java中类的初始化
- CF Codeforces Round #258 (Div. 2) B (451B)
- Ubuntu 用 pptp 建立 vpn 服务
- ##DAY6 UIScrollView
- 加密代理和Retrofit解密Converter
- 升鲜宝V2.0_生鲜配送行业,对生鲜配送系统开发与实施的深度对比与思考_升鲜宝生鲜配送系统_15382353715_余东升
- python学习第三次记录
- BZOJ3601 一个人的数论 莫比乌斯反演、高斯消元/拉格朗日插值
- js 日期 相关
- HTTPConnectionPool(host=&#39;xx.xx.xx.xx&#39;, port=xx): Max retries exceeded with url:(Caused by ConnectTimeoutError(<;urllib3.connection.HTTPConnection object at 0x0000015A25025EB8>;...))
- centos7下安装docker(13.2容器数据共享)
- 第01章 准备工作.md
- Mysql group_concat函数列转行,与行转列
- 【Python入门学习】列表生成和函数生成器的方式实现杨辉三角
热门文章
- SAP ABAP 日期相关函数
- Find发帖水王哥
- Android中使EditText失去焦点,edittext禁止弹出键盘[转]
- SQL高级优化之经常使用的优化策略-2(The Return Of The King)
- 使用QEMU调试Linux内核代码
- [置顶] String StringBuffer StringBuilder的区别剖析
- 精《记叙“tom”4年的软件开发之旅》
- RedHat7笔记
- X86(32位)与X64(64位)有什么区别,如何选择对应的操作系统和应用程序?
- eAccelerator介绍