Try JNI
Thanks for your reply.
I already tried to JNI wrapper. Here I given that code,
*****************************WRAPPER************** **************************
class ImageWrapper
{
Library library =null;
Function function =null;
PowerShot(String libname)
{
library = new Library(libname);
library.load();
}
public PrimitiveArray RetLiveImg(String fn_name)
{
function=library.getFunction(fn_name);
PrimitiveArray data = new PrimitiveArray(UInt8.class, 20480);
function.invoke(data);
return data;
}
public static void main(String args[])throws IOException
{
ImageWrapper wrap=new ImageWrapper("newdll");
function="?RetLiveImg@NewDemoDll@NewDll@@SAEXZ";
PrimitiveArray array=sdk.RetLiveImg(function);
byte[] buffer= array.getBytes();
FileOutputStream out=new FileOutputStream("liveimage.jpg");
out.write(buffer);
out.close();
}
}
When I compile above program, I got the following error,
*********************************ERROR ***************************************
D:>java ImageWrapper
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6d316eb0, pid=1416, tid=2440
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_12-b04 mixed mode, sharing)
# Problematic frame:
# C [java.dll+0x6eb0]
#
# An error report file with more information is saved as hs_err_pid1416.log
Shall you give a example to read the Binary Data from DLL?