Getting values generated from dll made in c++ in java
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   amul_Kumar
Posted On:   Monday, April 4, 2005 09:22 PM

Dear all i m implemenating ctypes package for implementation of dll with java. the question is there is a function in dll which required 4 to 5 parameter values that i m able to pass that required value from java program but i m getting problem while retrieving return values from that dll to java. i want to fetch the output values generated in dll from java program. how can i do this with the use of ctypes package. the code is as follows: import ctypes.java.CBuffer; import ctypes.java.CFunction; import ctypes.java.CInt; import ctypes.java.CDLL; import ctypes.java.CWString; import ctypes.java.*; import ju   More>>

Dear all


i m implemenating ctypes package for implementation of dll with java.

the question is there is a function in dll which required 4 to 5 parameter values that i m able to pass that required value from java program but i m getting problem while retrieving return values from that dll to java.
i want to fetch the output values generated in dll from java program.

how can i do this with the use of ctypes package.
the code is as follows:



import ctypes.java.CBuffer;

import ctypes.java.CFunction;

import ctypes.java.CInt;

import ctypes.java.CDLL;

import ctypes.java.CWString;

import ctypes.java.*;

import junit.framework.*;

import junit.textui.TestRunner;


class Test

{

public static void main(String args[])

{



String path = System.getProperty("java.library.path");



try

{



CDLL dll = CDLL.LoadLibrary("Protector.dll");
//System.out.println(dll);

CFunction fp = dll.loadFunction("Protect");



Object[] ary= { new CString
("c:\jni\sysInfo\jni.pdf"), new CString("1")};
// CInt cs = (CInt)fp.call(CInt.class, ary, CFunction.FUNCFLAG_CDECL);
//System.out.println(cs.getValue());

}catch(UnsatisfiedLinkError ULE)
{System.out.println(ULE);}

catch(Exception e)

{

System.out.println(e);

}



}

   <<Less
About | Sitemap | Contact