这里有一个用C写的lib文件,里面封装了n个函数,还有一份所有函数结构的说明文档,现在要通过JAVA来调用这些函数。实现其功能,具体函数的源文件没有。请问怎么怎么用JAVA调用这些函数?我用JNI实现的时候用VC编译,我是在C文件里直接调用了接口函数。希望各位高手给予指导,或者给指点一下方法,谢谢!在编译过程中报错:
Compiling...
testrcv.cpp
Linking...
Creating library Debug/testcas.lib and object Debug/testcas.exp
testrcv.obj : error LNK2001: unresolved external symbol "void __cdecl tr_pmsg(char *,int)" (?tr_pmsg@@YAXPADH@Z)
testrcv.obj : error LNK2001: unresolved external symbol "void __cdecl set_format(char *,...)" (?set_format@@YAXPADZZ)
testrcv.obj : error LNK2001: unresolved external symbol "struct ctl_tr_str Ctl_tr" (?Ctl_tr@@3Uctl_tr_str@@A)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_close(struct cas_gen_str *)" (?casmf_close@@YAFPAUcas_gen_str@@@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_snd(struct cas_gen_str *,char *)" (?casmf_snd@@YAFPAUcas_gen_str@@PAD@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_abort(struct cas_gen_str *)" (?casmf_abort@@YAFPAUcas_gen_str@@@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_rcv(struct cas_gen_str *,char *,int)" (?casmf_rcv@@YAFPAUcas_gen_str@@PADH@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_stop(void)" (?casmf_stop@@YAFXZ)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_open(struct cas_ope_str *,int,int)" (?casmf_open@@YAFPAUcas_ope_str@@HH@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_init(int,char *)" (?casmf_init@@YAFHPAD@Z)
Debug/testcas.dll : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.testcas.dll - 11 error(s), 0 warning(s)
其中报错的都是所要调用的lib里的函数
Compiling...
testrcv.cpp
Linking...
Creating library Debug/testcas.lib and object Debug/testcas.exp
testrcv.obj : error LNK2001: unresolved external symbol "void __cdecl tr_pmsg(char *,int)" (?tr_pmsg@@YAXPADH@Z)
testrcv.obj : error LNK2001: unresolved external symbol "void __cdecl set_format(char *,...)" (?set_format@@YAXPADZZ)
testrcv.obj : error LNK2001: unresolved external symbol "struct ctl_tr_str Ctl_tr" (?Ctl_tr@@3Uctl_tr_str@@A)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_close(struct cas_gen_str *)" (?casmf_close@@YAFPAUcas_gen_str@@@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_snd(struct cas_gen_str *,char *)" (?casmf_snd@@YAFPAUcas_gen_str@@PAD@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_abort(struct cas_gen_str *)" (?casmf_abort@@YAFPAUcas_gen_str@@@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_rcv(struct cas_gen_str *,char *,int)" (?casmf_rcv@@YAFPAUcas_gen_str@@PADH@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_stop(void)" (?casmf_stop@@YAFXZ)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_open(struct cas_ope_str *,int,int)" (?casmf_open@@YAFPAUcas_ope_str@@HH@Z)
testrcv.obj : error LNK2001: unresolved external symbol "short __cdecl casmf_init(int,char *)" (?casmf_init@@YAFHPAD@Z)
Debug/testcas.dll : fatal error LNK1120: 10 unresolved externals
Error executing link.exe.testcas.dll - 11 error(s), 0 warning(s)
其中报错的都是所要调用的lib里的函数
使java 代码与用其他编程语言编写的应用程序和库进行互操作。(其他编程语言大多是 c,c++和汇编语言。)