Let the main file where my functions and variables are located is example.cxx
Write that source.
Then create an interface file .let example.i
where the previous module's variables and functions have to be declared.
Sample:
/* example.i */
%module example
%{
/* Put header files here or function declarations like below */
extern type variableName;
extern type functionName(parameters);
%}
extern type variableName;
extern type functionName(parameters);
//end of file
Then create main java file.Let Its name is main.java
//main.java
public class main {
public static void main(String argv[]) {
System.loadLibrary("exampl
System.out.println(example
System.out.println(example
}
}
commands:
$swig -c++ -java example.i
$g++ -c -fpic example.cxx
$g++ -c -fpic example_wrap.cxx -I/usr/lib/jvm/java-6-sun-
$g++ -shared example.o example_wrap.o -o libexample.so
$export LD_LIBRARY_PATH=.:$LD_LIBR
$javac main.java
$java main
You can make a shell script to automate the commands.
1 comment:
Nice dispatch and this mail helped me alot in my college assignement. Thank you on your information.
Post a Comment