writing wrapper for dll
Hi,
I try to write the wrapper class for dll using J2Native. I have some problems while writting wrapper for the below dll function.
USB_STATUSWINAPIUSB_Initialize(short nWidth, short nHeight, HWND hWnd);
1. USB_STATUS
2. WINAPI
3. HWND
How i write the code in java for the above 3 keywords.
Regards,
Saravanan.K
[368 byte] By [
zzsaraa] at [2007-11-26 15:42:09]

# 1
Hi,If you were using JNative you would use 3 int--Marc ( http://jnative.sf.net)
# 2
Hi Marc,
Tanks for your help. Im new for writting wrapper in java for calling the dll functions.
Which interface i can use for easy accessing the dll?
JNI (or) J2native (or) JNative or Others.
Which is the easiest one?
If there is any interfaces for accessing the dll functions easily please help me with simple example programs and how to run?
Tanks in advance.
Regards,
Saravanan.K
# 3
Hai,How i write the structure and union using JNative. Plz help.Regards,Saravanan.K
# 4
Hi,
You can have a look to the official howto at http://jnative.free.fr/SPIP-v1-8-3/article.php3?id_article=4,
A union is basically a memory block that can handle multiple types of data, so MemoryBlockFactory.createMemoryBlock() can do it.
Download the sources from sourceforge (http://sourceforge.net/project/showfiles.php?group_id=156421) and see how Kernel32.java or User32.java are written.
Best,
--Marc (http://jnative.sf.net)
# 5
Hi,
Tanks for ur kind help,im not getting clear idea for writtin the warpper
so please help me. The below one is the DLL function. Tell me how to write the wrapper in JNative for the below function.
USB_STATUS WINAPIUSB_GetLiveImage (USB_IMAGE * pImage);
Note :
USB_IMAGE is a structure.
help me please ..
thanks,
Regards,
Saravanan.K
# 6
Hi,
I want to access device specfic libraries (available as windows native dll files ) from an Applet(signed Applet). I am planning to access the libraries by creating JNI wrappers for the same. Please confirm the technical feasibility of accessing dll from applet.
Regards,
Saravanan.K
# 7
Hi Marc,I want to access device specfic libraries (available as windows native dll files ) from an Applet(signed Applet) by using JNative . Please confirm the technical feasibility of accessing dll from applet.Regards,Saravanan.K
# 8
Hi,
I never tested from an applet, the sandbox may restrict your access to native methods.
I think you will need to have a signed applet.
Be aware, that JNative only works at this time on Linux x86 and Windows x86.
So x86_64, PPC, Sparc ... are not supported. And if you write a native access to a Windows DLL you'll need to do an other implementation for equivalent Linux lib.so, or vice-versa.
--Marc
# 9
Hi,
Thanks for your help,I want another help. How to write the wrapper class in java using JNative for the below structure and functuion.
-
typedef struct tagBITMAPINFO
{
BITMAPINFOHEADER bmtHeader;
RGBQUADbmiColors[1];
} BITMAPINFO;
typedef struct tagBITMAPINFOHEADER
{
DWORD biSize;
LONGbiWidth;
LONGbiHeight;
WORDbiPlanes;
WORDbiBitCount
DWORD biCompression;
DWORD biSizeImage;
LONGbiXPelsPerMeter;
LONGbiYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER;
typedef struct tagRGBQUAD
{
BYTErgbBlue;
BYTErgbGreen;
BYTErgbRed;
BYTErgbReserved;
} RGBQUAD;
typedef struct
{
LPBITMAPINFO lpBMI;
} USB_IMAGE, * PUSB_IMAGE;
Function:
-
USB_STATUS WINAPI USB_GetLiveImage (USB_IMAGE * pImage);
please help..
Regards,
Saravanan.K
# 10
Hi,Please take a look at http://jnative.free.fr/SPIP-v1-8-3/article.php3?id_article=10to learn how to deal with out structures.--Marc ( http://jnative.sf.net)