dcsimg
Calling functions in a dll from a java program.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   thomas_josephm
Posted On:   Wednesday, November 5, 2008 04:55 PM

Hi,

I have a dll which is supplied by a third party. I need to access the functions in that dll from a java program. I cannot modify the dll. Please let me know how I can use JNI to access the functions. Also let me know if there is any other way to call those functions. Sample codes will be really appreciated as I haven't worked in java for some time.

Also the functions in the dll has data types like DWORD, ULONG, LPSTR etc. How do I map these to java.

Thanks & Regards,
Thomas.

Re: Calling functions in a dll from a java program.

Posted By:   Robert_Lybarger  
Posted On:   Wednesday, November 5, 2008 07:26 PM

You will have to write your own dll that creates the JNI "bridge" between Java code and that other dll that you want to call into. This bridge code is where you handle the data type conversions. java.sun.com/docs/books/tutorial should have a trail that gives a starting look at writing and wiring JNI, although you will still have to know C code and how to use whichever C compiler/linker you have available to create your dll file.
About | Sitemap | Contact