Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

On DLL communication with IBM's Bridge2Java  RSS feed

 
Jeroen Oosterlaar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

For a web application project we need to write an interface between the database of the web application and the local database of a book keeping application. This book keeping application comes with a DLL which offers a database integrity safe gateway to its database, so that it can be used by software such as our web application, to read and write data.

It took me hours of finding a solution to let the Java application - that takes care of the synchronization - be able to communicate with the DLL. I almost gave up when I concluded that writing my own JNI compatible DLL wrapper was the only solution, until I came across a tool developed by IBM called Bridge2Java! And guess what, it worked! Bridge2Java contains a tool that can be used to generate stub classes from a DLL, containing all its functions and properties. The stub classes can then be used by within a Java application.

So this is really a great solution for everyone who wants to use DLL's with Java and does not have the time or simply does not want to dive into the field of writing JNI C interfaces.

For those who use or have used Bridge2Java I have a question. Where does Bridge2Java define its link with the DLL it wraps? The stub classes do not contain such a link, nor do I have to initialize some kind of reference to the DLL within my own code.

Thanks in advance!

Kind regards,

Jeroen Oosterlaar
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look for a call to "System.loadLibrary()" or possibly "System.load()" in the generated source , or in whatever runtime library code the tool provides. That would be the bridge between the Java and native code.
 
Jeroen Oosterlaar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ernest, I have searched all generated code that is used by my application, but the reference to the actual DLL is nowhere to be found. I find this very strange, since there must be a reference somewhere.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!