From 295c0331e911c9cd75c2c03597ce9a20ec995bd6 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sun, 27 Aug 2006 03:52:07 +0000 Subject: Changed NativeLibrary.open() to accept boolean argument indicating whether to search the system path first; perhaps useful if applications ship only a backup version of native libraries associated with a particular Java binding. In the case of JOAL we plan to ship a recent OpenAL implementation so we will not need to search the system path first. Changed ForceProcAddressGen directive to force call-through-function-pointer semantics for the targeted function. Changed JOAL to not link directly against the OpenAL library at all, but instead to look up all entry points using the GlueGen NativeLibrary class (instead of the custom dlsym code, now removed) in particular to solve DSO versioning problems on Linux. Updated EAX binding to work with dynamically loading OpenAL. Tested on Windows so far; more testing needed on Linux in Java Web Start scenarios. git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@42 a78bb65f-1512-4460-ba86-f6dc96a7bf27 --- .../procaddress/ProcAddressCMethodBindingEmitter.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/java/com/sun/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java') diff --git a/src/java/com/sun/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java b/src/java/com/sun/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java index 423f009..8dc46ee 100755 --- a/src/java/com/sun/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java +++ b/src/java/com/sun/gluegen/procaddress/ProcAddressCMethodBindingEmitter.java @@ -46,12 +46,14 @@ import com.sun.gluegen.cgram.types.*; public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { private boolean callThroughProcAddress; + private boolean needsLocalTypedef; private static String procAddressJavaTypeName = JavaType.createForClass(Long.TYPE).jniTypeName(); private ProcAddressEmitter emitter; public ProcAddressCMethodBindingEmitter(CMethodBindingEmitter methodToWrap, final boolean callThroughProcAddress, + boolean needsLocalTypedef, ProcAddressEmitter emitter) { super( new MethodBinding(methodToWrap.getBinding()) { @@ -91,6 +93,7 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { setCommentEmitter(defaultCommentEmitter); this.callThroughProcAddress = callThroughProcAddress; + this.needsLocalTypedef = needsLocalTypedef; this.emitter = emitter; } @@ -112,10 +115,24 @@ public class ProcAddressCMethodBindingEmitter extends CMethodBindingEmitter { protected void emitBodyVariableDeclarations(PrintWriter writer) { if (callThroughProcAddress) { // create variable for the function pointer with the right type, and set - // it to the value of the passed-in glProcAddress + // it to the value of the passed-in proc address FunctionSymbol cSym = getBinding().getCSymbol(); String funcPointerTypedefName = emitter.getFunctionPointerTypedefName(cSym); + + if (needsLocalTypedef) { + // We (probably) didn't get a typedef for this function + // pointer type in the header file; the user requested that we + // forcibly generate one. Here we force the emission of one. + PointerType funcPtrType = new PointerType(null, cSym.getType(), 0); + // Just for safety, emit this name slightly differently than + // the mangling would otherwise produce + funcPointerTypedefName = "_local_" + funcPointerTypedefName; + + writer.print(" typedef "); + writer.print(funcPtrType.toString(funcPointerTypedefName)); + writer.println(";"); + } writer.print(" "); writer.print(funcPointerTypedefName); -- cgit v1.2.3