Linux JNI实例及其JNI程序设计模板
简单实例说明待补充,实例源码可在此链接下载http://d.download.csdn.net/down/2389895/sanlinux
jniNative.cpp
#include "jniNative.h"
#include "mymain.h"
#include <stdio.h>
JNIEXPORT void JNICALL Java_HelloWorld_print(JNIEnv *env, jobject arg, jstring instring)
{
const char *str = (const char *)env->GetStringUTFChars(instring, JNI_FALSE);
printf("HELLO,%s\n",str);
env->ReleaseStringUTFChars(instring,str);
return;
}
JNIEXPORT void JNICALL Java_HelloWorld_test(JNIEnv *env, jobject arg, jstring instring)
{
const jbyte *str = (const jbyte *)env->GetStringUTFChars(instring, JNI_FALSE);
test((const char *)str);
env->ReleaseStringUTFChars(instring, (const char *)str);
return;
}
jniNative.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class HelloWorld */
//javac HelloWorld.java
//javah HelloWorld
//Copy from HelloWorld.h
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: HelloWorld
* Method: print
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_HelloWorld_print
(JNIEnv *, jobject, jstring);
/*
* Class: HelloWorld
* Method: test
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_HelloWorld_test
(JNIEnv *, jobject, jstring);
#ifdef __cplusplus
}
#endif
#endif
mymain.cpp
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mymain.h"
void test(const char *str)
{
char ch[50];
int len = 0;
strcat(ch,"Hello ");
&nbs
相关文档:
转载本站文章请注明,转载自:扶凯[http://www.php-oa.com]
本文链接: http://www.php-oa.com/2009/02/03/iostat.html
以前一直不太会用这个参数。现在认真研究了一下iostat,因为刚好有台重要的服务器压力高,所以放上来分析一下.下面这台就是IO有压力过大的服务器
$iostat -x 1
Linux 2.6.33-fukai (fukai-lap ......
Linux下的多线程编程
作者:姚继锋 2001-08-11 09:05:00
来自:http://www.china-pub.com
1 引言
线程(thread)技术早
在60年代就被提出,但真正应用多线程到操作系统中去,是在80年代中期,solaris是这方面的佼佼者。传统的Unix也支持线程的概念,但是在一个
进程(process)中只允许有一个线程,这样多线程 ......
Platform and tools: Ubuntu 9.04
Step 1, Download the nios linux tallbal
wget http://www.niosftp.com/pub/linux/nios2-linux-20090929.tar
or use xunlei to fix it.
Step2,
tar xvf nios2-linux-20090929.tar
cd nios2-linux
./checkout
Step 3, Generate the fpga.h f ......
从文件内容查找匹配指定字符串的行:
$ grep "被查找的字符串" 文件名
从文件内容查找与正则表达式匹配的行:
$ grep –e “正则表达式” 文件名
查找时不区分大小写:
$ grep –i "被查找的字符串" 文件名
查找匹配的行数:
$ grep -c "被查找的字符串" 文件名
......