/* * Copyright 2000 Perforce Software. All rights reserved. * * This file is part of Perforce - the FAST SCM System. * * Author: Michael Bishop * * Tabs: 4 spaces * * This is just JNI glue to make the java calls go through to the * native EnvironmentAccess object. * * The philosophy behind the Java glue is that, all of the native * objects are created natively. The pointer to that object is * passed to java where it stores it as an int. The value of that * int is actually a pointer in memory to the native object. * In this way, java can pass that int back to C code where it can * be casted to a C object pointer. When the java object is garbage * collected, it calls native code to delete the native pointer. * * All methods that are exposed with a java call are simply passed * through to native code where the native call is made. * */ #include "environmentaccess_jni.h" #include "JNIStringUtil.h" #include <stdlib.h> /* * Class: com_perforce_client_api_EnvironmentAccess * Method: nGetenv * Signature: (Ljava/lang/String;)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_com_perforce_client_api_EnvironmentAccess_nGetenv (JNIEnv * env, jclass, jstring jName) { char * name = jstring_to_cstring( env, jName ); char * value = getenv( name ); delete name; return cstring_to_jstring( env, value ); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 430 | Michael Bishop |
Initial checkin. Seems to work. Not very much testing. Not very much documentation. Some more commenting needs to take place. But, it's there to experiment with. |