• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to wrap c \ c++ (DLL files) in a servlet or a java application

 
Howard Zhao
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All
I am working on developping new web side applications (servlets). I was given some c\ c++ code which was used to generate DLL files as CGI to access back end database. Since the code was well developped and tested, I do not want to touch them at all. How can I write a "wrapper" so that I can use the code or DLL files in my servlets? I mean could I write a java based servlet / application to call these c \ c++ fuctions or use these DLL files?
Thanks a lot.
Have a nice nice holiday.
Howard
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I heared that a VB/VC++/ASP can call a java objects via com & JNI or something.
Example: A asp.net can call apache Fop and do the rendering.
I don't the reverse.Just have a look at some JNI documentation,may be it will help you.
Regards
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use this:

The dll/so e.g. for Win32 'dll_java.dll' or UNIX 'dll_java.so' should be placed in LD_LIBRARY_PATH (Unix) or PATH (Win32)
/Rene
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One alternative would be to run this C++ code as an application communicating with servlets via sockets. If the data that is passed for CGI access is something simple like a String, this works pretty well. Of course you would have to write some C code to handle the socket communication. One advantage - you can test it outside the servlet environment first.
You would have to watch out for multi-threading issues of course with JNI or any other approach.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic