From: Nitro <ni...@dr...> - 2007-02-12 13:43:19
|
Am 12.02.2007, 13:27 Uhr, schrieb Dennis Thrysøe <dt...@co...>: > Hello, > > I am faced with porting a Java JAR + dll to linux (jar+so file I guess). > I have the actual c-code for the dll, but not any JNI wrapper/converting > code. > > I have tried making a wrapper for these pretty simple c-functions with > swig, but I end up with a bunch of java code as well. > > Since the 3rd party JAR file already defines how the dll is invoked, I'm > seeking to build a very similar so file with the same entry points, so > that this file will work with the existing java code. > > Is this possible? Any recommendations? > > Thanks, > > -dennis SWIG is a tool which is intended for a situation like this: - You have at least a dll/so and the header for it - You want to call functions inside of this dll/so from a different language than C/C++ - SWIG generates code to allow to call functions across language boundaries (and much more, but that does not matter now) So if this JAR file can already access the C functions then you don't need SWIG. What you really want is to compile the source code of your dll as an .so file under linux. This might get a lot harder than just calling gcc on the source. If you are lucky the source is already compilable in linux and you can do whatever you need to do to compile it to an .so file. Then you should be able to use it along with the JAR file (as long as the jar file can handle .so files instead of the .dll ones it seems to be written for). -Matthias |