着急又郁闷:JNI能从linux下的静态库(.a文件)中调用函数么? to: bdsc() 请说一下细节好么,如何实现用so封装成.a的静态库呢 我快撑不住了,感谢!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 非常奇怪:在google里搜索 jni .a ,几乎没有任何同时包含jni和.a的信息,世界可是很大的啊,难道只有我有这样的需求?另一种可能就是,java处理.a库有别的大家都很熟的处理技术,大家都不像我这么傻?到底是怎么样的呢 你的so里#include staticA.h//call staticA里的函数没有什么细节 jni --call-->*.so --call-->*.a为什么不行,奇怪 再请教一下,编译的时候需要链接静态库,又要链接动态库这样的话gcc的编译参数怎么设置? to dbsc():我封装的demo都执行不了,给个答案吧 谢谢了,我的分怎么又送不出去呢![will@databack atoso]$ more libso.c#include <stdio.h>#include "libso.h"#include "libatest.h"void calla(){ atest(); //call from a static library(libatest.a) printf(".a convet to .so is ok\n"); return;}[will@databack atoso]$ more run.c#include <stdio.h>#include "libso.h"#include "libatest.h"int main(){ calla(); printf("oh ,3ks\n"); return 0;}[will@databack atoso]$ gcc run.c -o run -I. -L. -static -latest -shared -lso[will@databack atoso]$ ls -lF总用量 44-rw-r--r-- 1 will will 950 7月 18 22:24 libatest.a-rw-r--r-- 1 will will 13 7月 18 22:24 libatest.h-rw-r--r-- 1 will will 144 7月 18 22:30 libso.c-rw-r--r-- 1 will will 14 7月 18 22:27 libso.h-rw-r--r-- 1 will will 900 7月 18 22:31 libso.o-rw-r--r-- 1 will will 6648 7月 18 22:32 libso.so-rw-r--r-- 1 will will 116 7月 18 23:15 log.txt-rwxr--r-- 1 will will 6582 7月 18 23:11 run*-rw-r--r-- 1 will will 128 7月 18 22:39 run.c[will@databack atoso]$ ./run段错误这样(gcc run.c -o run -I. -L. -static -latest -shared -lso)编译后为什么运行出错呢? String[] c = {"1","2","3"}; 输出问题 eclipse打点提示 转换错误,不明白啊··· “/”应用程序中的服务器错误。 一个关于focusLost问题的处理 熟悉JDBC和Oracle store procedure 调用的大哥救命阿! 请帮忙看看这个程序有什么问题 为什么不能调用我自己的新类? 征求高见,想给自己找到一个出路 请教一个小问题:如何画函数? 读客户端文件写到服务器上 java中的字符串长度问题。
在google里搜索 jni .a ,几乎没有任何同时包含jni和.a的信息,世界可是很大的啊,难道只有我有这样的需求?另一种可能就是,java处理.a库有别的大家都很熟的处理技术,大家都不像我这么傻?到底是怎么样的呢
#include staticA.h
//call staticA里的函数没有什么细节
这样的话gcc的编译参数怎么设置?
我封装的demo都执行不了,给个答案吧 谢谢了,我的分怎么又送不出去呢![will@databack atoso]$ more libso.c
#include <stdio.h>
#include "libso.h"
#include "libatest.h"void calla()
{
atest(); //call from a static library(libatest.a)
printf(".a convet to .so is ok\n");
return;}
[will@databack atoso]$ more run.c
#include <stdio.h>
#include "libso.h"
#include "libatest.h"int main()
{
calla();
printf("oh ,3ks\n");
return 0;
}[will@databack atoso]$ gcc run.c -o run -I. -L. -static -latest -shared -lso[will@databack atoso]$ ls -lF
总用量 44
-rw-r--r-- 1 will will 950 7月 18 22:24 libatest.a
-rw-r--r-- 1 will will 13 7月 18 22:24 libatest.h
-rw-r--r-- 1 will will 144 7月 18 22:30 libso.c
-rw-r--r-- 1 will will 14 7月 18 22:27 libso.h
-rw-r--r-- 1 will will 900 7月 18 22:31 libso.o
-rw-r--r-- 1 will will 6648 7月 18 22:32 libso.so
-rw-r--r-- 1 will will 116 7月 18 23:15 log.txt
-rwxr--r-- 1 will will 6582 7月 18 23:11 run*
-rw-r--r-- 1 will will 128 7月 18 22:39 run.c
[will@databack atoso]$ ./run
段错误这样(gcc run.c -o run -I. -L. -static -latest -shared -lso)编译后为什么运行出错呢?