• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Why does your bag say "bombs"? The reason I ask is that my bag says "tiny ads" and it has stuff like this:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic