Package com.jogamp.gluegen
Class CCodeUnit
- java.lang.Object
-
- com.jogamp.gluegen.CodeUnit
-
- com.jogamp.gluegen.CCodeUnit
-
public class CCodeUnit extends CodeUnit
C code unit (a generated C source file), covering multipleFunctionEmitter
allowing to unify output, decoration and dynamic helper code injection per unit.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
emitHeader(String packageName, String className, List<String> customCode)
void
emitJNIEnvDecl()
EmitsgetJNIEnvDecl()
.void
emitJNIOnLoadJNIEnvCode(String libraryBasename)
static String
getJNIEnvDecl()
Returns native JNI declarations for `JVMUtil_GetJavaVM()`, `JVMUtil_GetJNIEnv(..)` and `JVMUtil_ReleaseJNIEnv(..)`.static String
getJNIOnLoadJNIEnvCode(String libraryBasename)
Returns native JNI code `JNI_OnLoad(..)` used for dynamic libraries, `JNI_OnLoad_{libraryBasename}(..)` used for static libraries, `JVMUtil_GetJNIEnv(..)` etc.String
toString()
-
Methods inherited from class com.jogamp.gluegen.CodeUnit
addTailCode, close, emit, emitf, emitln, emitln, emitTailCode
-
-
-
-
Field Detail
-
cUnitName
public final String cUnitName
base c-unit name with suffix.
-
NewDirectByteBufferCopyUnitCode
public static final String NewDirectByteBufferCopyUnitCode
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CCodeUnit
public CCodeUnit(String filename, String cUnitName, Object generator) throws IOException
- Parameters:
filename
- the class's full filename to open w/ write accesscUnitName
- the base c-unit name, i.e. c-file basename with suffixgenerator
- informal optional object that is creating this unit, used to be mentioned in a warning message if not null.- Throws:
IOException
-
-
Method Detail
-
emitJNIEnvDecl
public void emitJNIEnvDecl()
EmitsgetJNIEnvDecl()
.
-
emitJNIOnLoadJNIEnvCode
public void emitJNIOnLoadJNIEnvCode(String libraryBasename)
-
getJNIEnvDecl
public static final String getJNIEnvDecl()
Returns native JNI declarations for `JVMUtil_GetJavaVM()`, `JVMUtil_GetJNIEnv(..)` and `JVMUtil_ReleaseJNIEnv(..)`.See
getJNIOnLoadJNIEnvCode(String)
for details.- Returns:
- the code
- See Also:
getJNIOnLoadJNIEnvCode(String)
-
getJNIOnLoadJNIEnvCode
public static final String getJNIOnLoadJNIEnvCode(String libraryBasename)
Returns native JNI code `JNI_OnLoad(..)` used for dynamic libraries, `JNI_OnLoad_{libraryBasename}(..)` used for static libraries, `JVMUtil_GetJNIEnv(..)` etc.The `JNI_OnLoad*(..)` methods set a `static JavaVM* {libraryBasename}_jvmHandle`, which in turn is utilized by `JVMUtil_GetJNIEnv(..)` to attach a new thread to the `JavaVM*` generating a new `JNIEnv*`- or just to retrieve the thread's `JNIEnv*`, if already attached to the `JavaVM*`.
- Parameters:
libraryBasename
- library basename to generate the `JNI_OnLoad_{libraryBasename}(..)` variant for statically linked libraries.- Returns:
- the code
- See Also:
#getJNIOnLoadJNIEnvDecl(String)
-
-