Q:

How to insert platform-specific code in eclipse?

I'm working on an eclipse-based application, composed by several plug-ins. One of these plugins performs a computationally-intensive task, hence I want to provide a "native" implementation for some platforms I support. What is the best way to do it?
I was thinking about a base plugin (which provides the default implementation) extended with some fragments (to provide platform-specific implementations). However, how can the base plugin be aware of the available fragments?

A:

You could write a class in your main plugin similar to LocalFileNatives from org.eclipse.core.filesystem.  It loads a library that implements its set of native methods.  It then provides a facade to the system that uses the native implementation if it is available but has some default functionality for platforms where there are no native implementations.
Then each platform fragment simply provides the appropriate native DLL or .so
There are other options for having the fragment supply a service, that can be retrieved by the host plugin.

