1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <unistd.h>
32
33 #include <daemon/func.h>
34
35 #include "wsjni.h"
36 #include "jvm.h"
37
38
39 JNIEXPORT void JNICALL Java_webserver_ModuleLoader_addMethod
40 (JNIEnv *e, jobject loader, jstring funcName, jint safindex)
41 {
42 const char *name = (*e)->GetStringUTFChars(e, funcName ,
NULL);
43 printf(
"addMethod: Name: {%s} index: %d\n", name, safindex);
44
45 FuncStruct func;
46 func.name = strdup(name);
47 func.func =
NULL;
48 func.func_exec = jvm_method_exec;
49 func.exec_data = (
void*)safindex;
50 printf(
"exec_data: %d\n", func.exec_data);
51 add_function(&func);
52
53 (*e)->ReleaseStringUTFChars(e, funcName, name);
54 }
55
56