Book Image

Mastering Eclipse Plug-in Development

By : Alex Blewitt, Bandlem Limited
Book Image

Mastering Eclipse Plug-in Development

By: Alex Blewitt, Bandlem Limited

Overview of this book

Table of Contents (18 chapters)
Mastering Eclipse Plug-in Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Plugging in to JFace and the Common Navigator Framework
Index

Native libraries in OSGi bundles


To support loading native code in OSGi bundles, the framework defines a specific header, Bundle-NativeCode, which defines the libraries that are available to the bundle via the System.loadLibrary call.

The Bundle-NativeCode header defines one or more native libraries and a clause which states what operating systems and processor architectures are valid for each library. Calls to System.loadLibrary will then look for libraries mentioned in this list and use only those found for the appropriate architecture. In effect, the Bundle-NativeCode header replaces the java.library.path property.

In the prior example, the maths library was used for performing calculations. In an OSGi bundle, this could be packaged with the bundle itself and referred to via a manifest header:

Bundle-NativeCode: native/maths.dll

When calling System.loadLibrary("maths") on Windows, the native/maths.dll library will be automatically extracted to a suitable location on the filesystem and passed...