静态库和JNI [英] Static libraries and JNI

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

问题描述

我创建了一个头文件和一个相应的.c文件,其中包含我想与Java程序一起使用的功能.我使用javah创建了JNI头文件.我正在使用gcc编译我的头文件.如何将常规C对象文件与JNI静态库链接以获得使用C库的静态库?我正在使用gcc进行编译.

I have created a header file and a corresponding .c file full of functions I would like to use with a java program. I created a JNI header file using javah. I'm using gcc to compile my header file. How can I link my regular c object file with my JNI static library to get a static library that utilizes my C library? I'm using gcc to compile.

这是我要问的一个例子:

Here's an example of what I'm asking:

lib.h
lib.c
JNITest.h
JNITest.c (uses lib.h functions)

推荐答案

您可以尝试查看此内容 http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html

You might try looking at this http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jniexamp.html

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

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