| 1 28 import com.eaio.nativecall.Holder; 29 import com.eaio.nativecall.IntCall; 30 import com.eaio.nativecall.NativeCall; 31 import com.eaio.nativecall.VoidCall; 32 33 38 public class SimpleTest { 39 40 public static void main(String [] args) throws Exception { 41 42 if (args.length == 0) { 43 System.out.println( 44 "Usage: java " 45 + SimpleTest.class.getName() 46 + " [path to nctest.dll]"); 47 System.exit(1); 48 } 49 50 NativeCall.init(); 51 52 IntCall ic = new IntCall(args[0], "_test@4"); 53 int x = ic.executeCall(new Integer (42)); 54 System.out.println("x = " + x); 55 ic.destroy(); 56 57 VoidCall myFunc = new VoidCall(args[0], "_myFunc@12"); 58 Holder output1Holder = new Holder(new Integer (0)); 59 Holder output2Holder = new Holder(new Integer (0)); 60 myFunc.executeCall( 61 new Object [] { new Integer (2), output1Holder, output2Holder }); 62 System.out.println(output1Holder.get()); 63 System.out.println(output2Holder.get()); 64 myFunc.destroy(); 65 66 } 67 68 } 69 | Popular Tags |