Permalink
Browse files

update docs

  • Loading branch information...
twall committed Apr 6, 2013
1 parent 5cf120d commit 85d8d089726b30dd5d2daa399bc8c185b54ab8cd
Showing with 23 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +1 −0 CHANGES.md
  3. +3 −0 TODO
  4. +1 −1 build.xml
  5. +7 −1 src/com/sun/jna/Native.java
  6. +8 −0 src/com/sun/jna/NativeLibrary.java
  7. +2 −1 www/GettingStarted.md
View
@@ -16,3 +16,4 @@ dist/*-sources.jar
dist/*-javadoc.jar
dist/src-mvn.zip
dist/out-of-date.jar
+perf*.txt
View
@@ -27,6 +27,7 @@ Bug Fixes
* Remove deprecated methods on Memory (getSize,isValid) and Structure (getSize) - [@twall](https://github.com/twall).
* [#206](https://github.com/twall/jna/pull/206): Fix `moveToTrash()` on OSX to work with symlinks - [@twall](https://github.com/twall).
* Remove problematic AWT check via `Class.forName("java.awt.Component")` (see [here](https://bugs.eclipse.org/bugs/show_bug.cgi?id=388170)) - [@twall](https://github.com/twall).
+* [PR#210](https://github.com/twall/jna/pull/210) Add OSGI processor specs for Mac OS X - [@bertfrees](https://github.com/bertfrees).
Release 3.5.1
=============
View
3 TODO
@@ -21,6 +21,9 @@
# TODO
+* use consistent cpu references (x86->i386, x86_64->amd64)
+* osgi for osx
+
* make native dll extraction from jar public, to use with user dlls packaged
in a jar
View
@@ -368,7 +368,7 @@ com/sun/jna/freebsd-amd64/libjnidispatch.so;
processor=x86-64;osname=freebsd,
com/sun/jna/darwin/libjnidispatch.jnilib;
-osname=macosx;processor=x86;processor=x86_64;processor=ppc
+osname=macosx;processor=x86;processor=x86-64;processor=ppc
"/>
</manifest>
<fileset dir="${classes}" excludes="${jar.omitted}">
@@ -77,6 +77,10 @@
* finalized/disposed before this class is disposed and/or removed from
* memory (most notably Memory and any other class which by default frees its
* resources in a finalizer).<p/>
+ * <a name=native_library_loading</a>
+ * <h2>Native Library Loading</h2>
+ * Native libraries loaded via {@link #loadLibrary(Class)} may be found in
+ * <a href="NativeLibrary.html#library_search_paths">several locations</a>.
* @see Library
* @author Todd Fast, todd.fast@sun.com
* @author twall@users.sf.net
@@ -367,6 +371,8 @@ public static Object loadLibrary(String name, Class interfaceClass) {
* If no library options are detected the map is interpreted as a map
* of Java method names to native function names.<p>
* If <code>name</code> is null, attempts to map onto the current process.
+ * Native libraries loaded via this method may be found in
+ * <a href="NativeLibrary.html#library_search_paths">several locations</a>.
* @param name
* @param interfaceClass
* @param options Map of library options
@@ -777,7 +783,7 @@ static File extractFromResourcePath(String name) throws IOException {
/** Attempt to extract a native library from the current resource path.
* Expects native libraries to be stored under
- * the path returned by {@link #getNativeLibraryResourcePath(int, String,
+ * the path returned by {@link #getNativeLibraryResourcePrefix(int, String,
* String)}.
* @param name Base name of native library to extract
* @param loader Class loader to use to load resources
@@ -37,6 +37,7 @@
* class corresponds to a single loaded native library. May also be used
* to map to the current process (see {@link NativeLibrary#getProcess()}).
* <p>
+ * <a name=library_search_paths></a>
* <b>Library Search Paths</b>
* A search for a given library will scan the following locations:
* <ol>
@@ -49,6 +50,13 @@
* are also accepted, either ending at the framework name (sans ".framework")
* or the full path to the framework shared library
* (e.g. CoreServices.framework/CoreServices).
+ * <li>Context class loader classpath. Deployed native libraries may be
+ * installed on the classpath under
+ * <code>${os-prefix}/LIBRARY_FILENAME</code>, where <code>${os-prefix}</code>
+ * is the OS/Arch prefix returned by {@link
+ * Native#getNativeLibraryResourcePrefix()}. If bundled in a jar file, the
+ * resource will be extracted to <code>jna.tmpdir</code> for loading, and
+ * later removed.
* </ol>
* @author Wayne Meissner, split library loading from Function.java
* @author twall
View
@@ -37,10 +37,11 @@ The following example maps the printf function from the standard C library and c
Identify a native target library that you want to use. This can be any shared library with exported functions. Many examples of mappings for common system libraries, especially on Windows, may be found in the platform package.
-Make your target library available to your Java program. There are two ways to do this:
+Make your target library available to your Java program. There are several ways to do this:
* The preferred method is to set the `jna.library.path` system property to the path to your target library. This property is similar to `java.library.path`, but only applies to libraries loaded by JNA.
* Change the appropriate library access environment variable before launching the VM. This is `PATH` on Windows, `LD_LIBRARY_PATH` on Linux, and `DYLD_LIBRARY_PATH` on OSX.
+* Make your native library available on your classpath, under the path `{OS}-{ARCH}/{LIBRARY}`, where `{OS}-{ARCH}` is JNA's canonical prefix for native libraries (e.g. `win32-x86`, `linux-amd64`, or `darwin`). If the resource is within a jar file it will be automatically extracted when loaded.
Declare a Java interface to hold the native library methods by extending the Library interface.

0 comments on commit 85d8d08

Please sign in to comment.