小弟一直没用过Linux。
平时的码也只是在WINDOW上用SWIG或CYGWIN进行编译。
下面的例子,先从网上找来一个.c文件。
example.c
/* File : example.c */
#include
double My_variable = 3.0;
int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}
int my_mod(int x, int y) {
return (x%y);
}
char *get_time()
{
time_t ltime;
time(
return ctime(
}
要生成Java接口,就需要编写.i文件。
文件 example.i
/* example.i */
%module example
%{
/* Put header files here or function declarations like below */
extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();
%}
extern double My_variable;
extern int fact(int n);
extern int my_