Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling a DLL from Java

 
Humberto Hernandez
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We want to call DLL methods from Java the same way they are called from a Visual Basic programm.
From what we have researched we have to do the following:
- Use JNI to call a C/C++ program. (Done)
- From the C++ program call the DLL. (Mmmh!)
In the second point we can call a regular function in the DLL compiled from a C program. But we don`t know how to call the method of an object for a purchased DLL. As a matter a fact we don't even know if it was generated from C,C++ or Visual Basic.
I know this question is more related to the usage DLLs but I don`t want to be seen asking questions in a Microsoft forum.:-)
We will appreciate if anyone can point us to an example.
--
Humberto
 
Humberto Hernandez
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking closer at the litearature, it seems that what we really want to do is to call a COM object from Java.
Can I do it from Java or do I have to use C++.
--
Humberto
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Com DLL's present a full set of other problems. The biggest is that they return MS specific Objects and not just c data types. Another is that they aren't stand alone and need a host application to run. You can create a c or c++ (or VB for that matter) wrapper to execute and convert the MS Objects to C or Java types.
If your company doesn't want to go through the time and expense, Linar Ltd. out of Engalnd has a pure java product called Jintegra which can access a comm dll using dllhost.exe as the executable. For more information check out their site here http://www.linar.com/
Hope this helps
 
Neetu Gupta
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You Must be having lib files also along with the DLL. If you have that, then put your dll in the system32 directory and link the lib files in your c++ project. It should work fine if the dll supports c++ calls
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic