This Question is Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
1 Replies Last post: Oct 24, 2009 1:49 AM by Nitin  
Nitin   2 posts since
Oct 24, 2009
Currently Being Moderated

Oct 24, 2009 1:18 AM

Understanding the mapping between the DLL and JNIWrapper

Hi,

 

I am new to JNIWrapper and am trying to invoke a method on a DLL (lets assume DLLA for this example) and the method signature looks like below

 

ULONG GetDevice ( DWORD dwDeviceContext, char *pcDevName );

 

brief description of the parmeters

dwDeviceContext - This is the device number of the device. This must be set to 1 to get the first device in the system. Increment it by 1 to get the next device name.

pcDevName - Pointer to the buffer where the device name will be stored.

 

 

I am not sure how to map the JNIWrapper call to this function. Below is how my code looks. I do not get any data back from the DLL call. I know the DLL works since i have tried the same thing with other DLL Wrappers. This is my first time with thei application so it si certainly something i am doing. I would appreciate any help in getting this working or getting a better understanding of how this works.

 



 

 

callingFunction = MY_LIB.getFunction("GetDevice");



 

 

deviceNameANSI = new AnsiString(32);

com.jniwrapper.Pointer deviceNameContext =

new com.jniwrapper.Pointer(deviceNameANSI);



 

int deviceCounter = 1;

Int deviceNumber =



new Int(deviceCounter);



 

 

returnValue = callingFunction.invoke(null, new com.jniwrapper.Pointer(deviceNumber), deviceNameContext);



 

 

 

System.out.println(

"device name "+ deviceNameANSI);





 

 





 

 

Thanks,

Nitin

More Like This

  • Retrieving data ...