source: trunk/src/gcc/libjava/testsuite/libjava.jni/register.c@ 604

Last change on this file since 604 was 2, checked in by bird, 23 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 588 bytes
Line 
1#include <stdlib.h>
2#include <assert.h>
3#include <register.h>
4
5static jint
6some_random_name (JNIEnv *env, jclass k, jint v)
7{
8 return v - 1;
9}
10
11jint
12JNI_OnLoad (JavaVM *vm, void *nothing)
13{
14 JNIEnv *env;
15 JNINativeMethod meth;
16 jclass k;
17 jint r;
18
19 r = (*vm)->GetEnv (vm, (void **) &env, JNI_VERSION_1_2);
20 assert (r == JNI_OK);
21 k = (*env)->FindClass (env, "register");
22 assert (k != NULL);
23
24 meth.name = "doit";
25 meth.signature = "(I)I";
26 meth.fnPtr = some_random_name;
27
28 r = (*env)->RegisterNatives (env, k, &meth, 1);
29 assert (r == JNI_OK);
30
31 return JNI_VERSION_1_2;
32}
Note: See TracBrowser for help on using the repository browser.