Mercurial > pub > dyncall > bindings
comparison java/jdc/src/org_dyncall_DC.c @ 18:3bfef07b0cd9
- cleanup of non-working java binding, restart work, somewhat different interface
author | cslag |
---|---|
date | Wed, 30 Mar 2016 02:05:06 +0200 |
parents | 0cfcc391201f |
children |
comparison
equal
deleted
inserted
replaced
17:739c40f35a6a | 18:3bfef07b0cd9 |
---|---|
1 #include "org_dyncall_DC.h" | 1 #include "org_dyncall_DC.h" |
2 #include "../../../../dyncall/dyncall.h" | 2 #include "dyncall.h" |
3 jlong JNICALL Java_org_dyncall_DC_newCallVM | 3 |
4 (JNIEnv *pEnv, jclass clazz, jint mode, jint size) | 4 jlong JNICALL Java_org_dyncall_DC_newCallVM(JNIEnv *pEnv, jclass clazz, jint mode, jint size) |
5 { | 5 { |
6 return (jlong) dcNewCallVM(mode,size); | 6 return (jlong)dcNewCallVM(mode, size); |
7 //@@@ free | |
7 } | 8 } |
8 | 9 |
9 void JNICALL Java_org_dyncall_DC_reset (JNIEnv *, jclass, jlong vm) | 10 jlong JNICALL Java_org_dyncall_DC_load(JNIEnv *, jclass, jstring s) |
10 { | 11 { |
11 DCCallVM* vm = (DCCallVM*) in_vm; | 12 return dlLoadLibrary((const char*)s); |
12 dcReset(vm); | 13 //@@@ free |
13 } | 14 } |
14 | 15 |
15 void JNICALL Java_org_dyncall_DC_argBool(JNIEnv *, jclass, jlong vm, jboolean b) | 16 jlong JNICALL Java_org_dyncall_DC_find(JNIEnv *, jclass, jlong libhandle, jstring s) |
16 { | 17 { |
17 DCCallVM* vm = (DCCallVM*) in_vm; | 18 return dlFindSymbol((DLLib*)libhandle, (const char*)s); |
18 dcPushBool(vm,b); | |
19 } | 19 } |
20 | 20 |
21 void JNICALL Java_org_dyncall_DC_argByte (JNIEnv *, jclass, jlong in_vm, jbyte b) | 21 //jint JNICALL Java_org_dyncall_DC_symsCount(JNIEnv *, jclass, jlong symshandle) |
22 //{ | |
23 // return dlSymsCount((DLSyms*)symshandle); | |
24 //} | |
25 | |
26 //jstring JNICALL Java_org_dyncall_DC_symsName(JNIEnv *, jclass, jlong symshandle, jint i) | |
27 //{ | |
28 // return dlSymsName((DLSyms*)symshandle, i); | |
29 //} | |
30 | |
31 void JNICALL Java_org_dyncall_DC_mode(JNIEnv *, jclass, jlong in_vm, jint i) | |
22 { | 32 { |
23 DCCallVM* vm = (DCCallVM*) in_vm; | 33 dcMode((DCCallVM*)in_vm, i); |
24 dcPushChar(vm,b); | |
25 } | 34 } |
35 | |
36 void JNICALL Java_org_dyncall_DC_reset(JNIEnv *, jclass, jlong in_vm) | |
37 { | |
38 dcReset((DCCallVM*)in_vm); | |
39 } | |
40 | |
41 void JNICALL Java_org_dyncall_DC_argBool(JNIEnv *, jclass, jlong in_vm, jboolean b) | |
42 { | |
43 dcPushBool((DCCallVM*)in_vm, b); | |
44 } | |
45 | |
46 void JNICALL Java_org_dyncall_DC_argChar(JNIEnv *, jclass, jlong in_vm, jbyte b) | |
47 { | |
48 dcPushChar((DCCallVM*)in_vm, b); | |
49 } | |
50 | |
26 void JNICALL Java_org_dyncall_DC_argShort(JNIEnv *, jclass, jlong in_vm, jshort s) | 51 void JNICALL Java_org_dyncall_DC_argShort(JNIEnv *, jclass, jlong in_vm, jshort s) |
27 { | 52 { |
28 DCCallVM* vm = (DCCallVM*) in_vm; | 53 dcPushShort((DCCallVM*)in_vm, s); |
29 dcPushShort(vm,s); | |
30 } | 54 } |
31 | 55 |
32 void JNICALL Java_org_dyncall_DC_argInt(JNIEnv *, jclass, jlong in_vm, jint i) | 56 void JNICALL Java_org_dyncall_DC_argInt(JNIEnv *, jclass, jlong in_vm, jint i) |
33 { | 57 { |
34 DCCallVM* vm = (DCCallVM*) in_vm; | 58 dcPushInt((DCCallVM*)in_vm, i); |
35 dcPushInt(vm,i); | |
36 | |
37 } | |
38 void JNICALL Java_org_dyncall_DC_argLong (JNIEnv *, jclass, jlong in_vm, jlong l) | |
39 { | |
40 DCCallVM* vm = (DCCallVM*) in_vm; | |
41 dcPushLong(vm,l); | |
42 } | 59 } |
43 | 60 |
44 void JNICALL Java_org_dyncall_DC_argChar(JNIEnv *, jclass, jlong in_vm, jchar c) | 61 void JNICALL Java_org_dyncall_DC_argLong(JNIEnv *, jclass, jlong in_vm, jlong l) |
45 { | 62 { |
46 DCCallVM* vm = (DCCallVM*) in_vm; | 63 dcPushLong((DCCallVM*)in_vm, l); |
47 dcPushChar(vm,c); | 64 } |
65 | |
66 void JNICALL Java_org_dyncall_DC_argLongLong(JNIEnv *, jclass, jlong in_vm, jlong l) | |
67 { | |
68 dcPushLongLong((DCCallVM*)in_vm, l); | |
48 } | 69 } |
49 | 70 |
50 void JNICALL Java_org_dyncall_DC_argFloat(JNIEnv *, jclass, jlong in_vm, jfloat f) | 71 void JNICALL Java_org_dyncall_DC_argFloat(JNIEnv *, jclass, jlong in_vm, jfloat f) |
51 { | 72 { |
52 DCCallVM* vm = (DCCallVM*) in_vm; | 73 dcPushFloat((DCCallVM*)in_vm, f); |
53 dcPushFloat(vm,f); | |
54 } | 74 } |
55 | 75 |
56 void JNICALL Java_org_dyncall_DC_argDouble(JNIEnv *, jclass, jlong in_vm, jdouble d) | 76 void JNICALL Java_org_dyncall_DC_argDouble(JNIEnv *, jclass, jlong in_vm, jdouble d) |
57 { | 77 { |
58 DCCallVM* vm = (DCCallVM*) in_vm; | 78 dcPushDouble((DCCallVM*)in_vm, d); |
59 dcPushDouble(vm,d); | |
60 } | 79 } |
61 | 80 |
62 void JNICALL Java_org_dyncall_DC_argPointer__JJ(JNIEnv *, jclass, jlong in_vm, jlong l) | 81 void JNICALL Java_org_dyncall_DC_argPointer__JJ(JNIEnv *, jclass, jlong in_vm, jlong l) |
63 { | 82 { |
64 DCCallVM* vm = (DCCallVM*) in_vm; | 83 dcPushPointer((DCCallVM*)in_vm, (DCpointer)l); |
65 dcPushPointer(vm, (DCpointer) l ); | |
66 } | 84 } |
67 | 85 |
68 void JNICALL Java_org_dyncall_DC_argPointer__JLjava_lang_Object_2(JNIEnv *, jclass, jlong in_vm, jobject o) | 86 void JNICALL Java_org_dyncall_DC_argPointer__JLjava_lang_Object_2(JNIEnv *, jclass, jlong in_vm, jobject o) |
69 { | 87 { |
70 DCCallVM* vm = (DCCallVM*) in_vm; | 88 dcPushPointer((DCCallVM*)in_vm, (DCpointer)o); |
71 dcPushPointer(vm, (DCpointer) o ); | |
72 } | 89 } |
73 | 90 |
74 void JNICALL Java_org_dyncall_DC_argString(JNIEnv *, jclass, jlong, jstring) | 91 void JNICALL Java_org_dyncall_DC_argString(JNIEnv *, jclass, jlong in_vm, jstring s) |
75 { | 92 { |
76 DCCallVM* vm = (DCCallVM*) in_vm; | 93 dcPushPointer((DCCallVM*)in_vm, (DCpointer)s); |
77 dcPushPointer(vm, (DCpointer) o ); | |
78 } | 94 } |
79 | 95 |
80 void JNICALL Java_org_dyncall_DC_callVoid (JNIEnv *, jclass, jlong in_vm, jlong in_target) | 96 void JNICALL Java_org_dyncall_DC_callVoid (JNIEnv *, jclass, jlong in_vm, jlong in_target) |
81 { | 97 { |
82 DCCallVM* vm = (DCCallVM*) in_vm; | 98 dcCallVoid((DCCallVM*)in_vm, (DCpointer)target) |
83 dcCallVoid(vm, (DCpointer) target) | |
84 } | 99 } |
85 | 100 |
86 /* | 101 jboolean JNICALL Java_org_dyncall_DC_callBool(JNIEnv *, jclass, jlong in_vm, jlong target) |
87 * Class: org_dyncall_DC | |
88 * Method: callBoolean | |
89 * Signature: (JJ)Z | |
90 */ | |
91 jboolean JNICALL Java_org_dyncall_DC_callBoolean(JNIEnv *, jclass, jlong in_vm, jlong target) | |
92 { | 102 { |
93 DCCallVM* vm = (DCCallVM*) in_vm; | 103 return dcCallBool((DCCallVM*)in_vm, (DCpointer)target) |
94 dcCallBoolean(vm, (DCpointer) target) | |
95 } | 104 } |
96 | 105 |
97 /* | 106 jbyte JNICALL Java_org_dyncall_DC_callChar(JNIEnv *, jclass, jlong in_vm, jlong target) |
98 * Class: org_dyncall_DC | 107 { |
99 * Method: callInt | 108 return dcCallChar((DCCallVM*)in_vm, (DCpointer)target) |
100 * Signature: (JJ)I | 109 } |
101 */ | |
102 JNIEXPORT jint JNICALL Java_org_dyncall_DC_callInt | |
103 (JNIEnv *, jclass, jlong, jlong); | |
104 | 110 |
105 /* | 111 jshort JNICALL Java_org_dyncall_DC_callShort(JNIEnv *, jclass, jlong in_vm, jlong target) |
106 * Class: org_dyncall_DC | 112 { |
107 * Method: callLong | 113 return dcCallShort((DCCallVM*)in_vm, (DCpointer)target) |
108 * Signature: (JJ)J | 114 } |
109 */ | |
110 JNIEXPORT jlong JNICALL Java_org_dyncall_DC_callLong | |
111 (JNIEnv *, jclass, jlong, jlong); | |
112 | 115 |
116 jint JNICALL Java_org_dyncall_DC_callInt(JNIEnv *, jclass, jlong in_vm, jlong target) | |
117 { | |
118 return dcCallInt((DCCallVM*)in_vm, (DCpointer)target) | |
119 } | |
120 | |
121 jlong JNICALL Java_org_dyncall_DC_callLong(JNIEnv *, jclass, jlong in_vm, jlong target) | |
122 { | |
123 return dcCallLong((DCCallVM*)in_vm, (DCpointer)target) | |
124 } | |
125 | |
126 jlong JNICALL Java_org_dyncall_DC_callLongLong(JNIEnv *, jclass, jlong in_vm, jlong target) | |
127 { | |
128 return dcCallLongLong((DCCallVM*)in_vm, (DCpointer)target) | |
129 } | |
130 | |
131 jfloat JNICALL Java_org_dyncall_DC_callFloat(JNIEnv *, jclass, jlong in_vm, jlong target) | |
132 { | |
133 return dcCallFloat((DCCallVM*)in_vm, (DCpointer)target) | |
134 } | |
135 | |
136 jdouble JNICALL Java_org_dyncall_DC_callDouble(JNIEnv *, jclass, jlong in_vm, jlong target) | |
137 { | |
138 return dcCallDouble((DCCallVM*)in_vm, (DCpointer)target) | |
139 } | |
140 | |
141 jlong JNICALL Java_org_dyncall_DC_callPointer(JNIEnv *, jclass, jlong in_vm, jlong target) | |
142 { | |
143 return dcCallPointer((DCCallVM*)in_vm, (DCpointer)target) | |
144 } | |
145 | |
146 jstring JNICALL Java_org_dyncall_DC_callString(JNIEnv *, jclass, jlong in_vm, jlong target) | |
147 { | |
148 return dcCallPointer((DCCallVM*)in_vm, (DCpointer)target) | |
149 } | |
150 | |
151 jint JNICALL Java_org_dyncall_DC_getError(JNIEnv *, jclass, jlong in_vm) | |
152 { | |
153 return dcGetError((DCCallVM*)in_vm); | |
154 } | |
155 |