diff options
author | Kenneth Russel <[email protected]> | 2006-08-01 23:22:54 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2006-08-01 23:22:54 +0000 |
commit | 5f3f32052969e8133c8fe7c50835763cedfebb43 (patch) | |
tree | 6ccd8ac7f94ee02ce16b5568d8c965b1c74c9a09 /src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java | |
parent | ff5fa954165c45037849b986f41f4a192cad163e (diff) |
Added NativeLibrary helper class to com.sun.gluegen.runtime package,
principally to generally solve the problem of downloading dependent
libraries of GlueGen-generated native code, as in the case of JOAL and
OpenAL reported recently by Shawn Kendall on JOAL forums.
Autogenerated Java and native code associated with this new
NativeLibrary helper class is currently checked in to the GlueGen
workspace to make it easier to build across multiple platforms; it can
be regenerated by running the generate.nativelibrary.sources Ant
target in the GlueGen workspace. Building of the native code in the
GlueGen workspace is currently disabled by default and can be enabled
by specifying -Dbuild.native=1 on the ant command line. Use of the new
NativeLibrary class in JOAL is currently disabled by default and can
be enabled by specifying -Djoal.use.gluegen=1 to applications using
JOAL. New functionality has been lightly tested with JOAL on Windows
and appears to be working. More testing, including build and Java Web
Start deployment testing, to follow on other platforms.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@37 a78bb65f-1512-4460-ba86-f6dc96a7bf27
Diffstat (limited to 'src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java')
-rwxr-xr-x | src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java b/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java new file mode 100755 index 0000000..c1d2fa0 --- /dev/null +++ b/src/java/com/sun/gluegen/runtime/WindowsDynamicLinkerImpl.java @@ -0,0 +1,38 @@ +/* !---- DO NOT EDIT: This file autogenerated by com\sun\gluegen\JavaEmitter.java on Mon Jul 31 16:26:59 PDT 2006 ----! */ + +package com.sun.gluegen.runtime; + +import com.sun.gluegen.runtime.*; + +public class WindowsDynamicLinkerImpl implements DynamicLinker +{ + + + /** Interface to C language function: <br> <code> BOOL FreeLibrary(HANDLE hLibModule); </code> */ + private static native int FreeLibrary(long hLibModule); + + /** Interface to C language function: <br> <code> DWORD GetLastError(void); </code> */ + private static native int GetLastError(); + + /** Interface to C language function: <br> <code> PROC GetProcAddress(HANDLE hModule, LPCSTR lpProcName); </code> */ + private static native long GetProcAddress(long hModule, java.lang.String lpProcName); + + /** Interface to C language function: <br> <code> HANDLE LoadLibraryA(LPCSTR lpLibFileName); </code> */ + private static native long LoadLibraryA(java.lang.String lpLibFileName); + + + // --- Begin CustomJavaCode .cfg declarations + public long openLibrary(String libraryName) { + return LoadLibraryA(libraryName); + } + + public long lookupSymbol(long libraryHandle, String symbolName) { + return GetProcAddress(libraryHandle, symbolName); + } + + public void closeLibrary(long libraryHandle) { + FreeLibrary(libraryHandle); + } + // ---- End CustomJavaCode .cfg declarations + +} // end of class WindowsDynamicLinkerImpl |