- 论坛徽章:
- 31
|
第一点,我没有听说过。
给你一个openjdk6的实现:
- ......
- /* Macro to get JNI function pointer. */
- #define JNI_FUNC_PTR(env,f) (*((*(env))->f))
- /* Macro to get JVM function pointer. */
- #define JVM_FUNC_PTR(env,f) (*((*(env))->f))
- /* Macro to get JVMTI function pointer. */
- #define JVMTI_FUNC_PTR(env,f) (*((*(env))->f))
- .....
- static jclass
- findClass(JNIEnv *env, const char * name)
- {
- jclass x;
- if ( env == NULL ) {
- EXIT_ERROR(AGENT_ERROR_ILLEGAL_ARGUMENT,"findClass env");
- }
- if ( name == NULL || name[0] == 0 ) {
- EXIT_ERROR(AGENT_ERROR_ILLEGAL_ARGUMENT,"findClass name");
- }
- x = JNI_FUNC_PTR(env,FindClass)(env, name);
- if (x == NULL) {
- ERROR_MESSAGE(("JDWP Can't find class %s", name));
- EXIT_ERROR(AGENT_ERROR_NULL_POINTER,NULL);
- }
- if ( JNI_FUNC_PTR(env,ExceptionOccurred)(env) ) {
- ERROR_MESSAGE(("JDWP Exception occurred finding class %s", name));
- EXIT_ERROR(AGENT_ERROR_NULL_POINTER,NULL);
- }
- return x;
- }
复制代码 |
|