views:

348

answers:

3

I have a couple of native applications written in C++ and C#. These are legacy applications that require data sharing between them. Currently, data sharing is through import/export of text file in some proprietary format. We are currently looking at integrating these two applications using eclipse. My questions are:

  1. How can we integrate native applications such as c++ and c# based applications into eclipse?
  2. What kind of data integration methods does eclipse provide for native applications?
  3. Is eclipse the best choice for such use?

Also, it will be very helpful if you can share your experiences about integrating native applications in eclipse.

[EDIT] I am specifically looking at integrating native applications into eclipse just the way we would integrate a eclipse plugin written in Java. For example, what does it take to write a wrapper plugin in Java which will wrap a native tool by using JNI calls that can be integrated into eclipse just as any other eclipse plugin? Is this is a preferred approach for integrating native applications or is it a good idea to rewrite my legacy native application in Java?

I am not looking at using eclipse as a launch pad for my native applications using the "External Tools" configuration.

A: 

There's nothing inherently specific about Eclipse here (that's not to say you can't use it as an IDE). Basically, you should look at P/Invoke, COM Interop, and MSDN's (vast) section on Managed-Unmanaged Interoperability. While you could integrate both sides with Java/SWT, and use it as the middle-man, I don't think that makes much sense.

Matthew Flaschen
A: 

If you just want to run the apps from inside eclipse use the external tools infrastructure.

If not, please provide more details on the integration that you seek.

lothar
I am specifically looking at integrating native applications into eclipse just the way we would integrate a eclipse plugin written in Java. For example, what does it take to write a wrapper plugin in Java which will wrap a native tool by using JNI calls that can be integrated into eclipse just as any other eclipse plugin? Is this is a preferred approach for integrating native applications or is it a good idea to rewrite my legacy native application in Java?I am not looking at using eclipse as a launch pad for my native applications using the "External Tools" configuration.
Suresh Kumar
+2  A: 

If you can write a JNI wrapper around your C++/C# applications, then you can use them from an Eclipse plugin.

The simplest approach is to:

  1. repackage your C++/C# applications as DLLs (if they aren't already)
  2. wrap them with a JNI layer
  3. place the DLLs in the root folder of your plugin
  4. call System.LoadLibrary() from a static initializer block in your JNI wrapper class to load required DLLs

You might find the discussion on the Eclipse newsgroup entitled Using DLL in an Eclipse plugin helpful.

Ken Dyck