[入门] 请问一下谁用d语言给java写过native方法
lipogem
2008-07-30
我试了一下怎么总是指令引用的内存不能为“read”呢?
这是dll的代码 import std.c.windows.windows; import jni; HINSTANCE g_hInst; extern (C) { void gc_init(); void gc_term(); void _minit(); void _moduleCtor(); void _moduleUnitTests(); } extern (Windows) BOOL DllMain(HINSTANCE hInstance, ULONG ulReason, LPVOID pvReserved) { switch (ulReason) { case DLL_PROCESS_ATTACH: gc_init(); _minit(); _moduleCtor(); _moduleUnitTests(); break; case DLL_PROCESS_DETACH: gc_term(); break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: return false; } g_hInst=hInstance; return true; } jint Java_javajnidemo_Main_addTwoNumbers (JNIEnv *, jobject, jint jt1, jint jt2) { return jt1+jt2; } jint Java_javajnidemo_Main_multiplyTwoNumbers(JNIEnv *, jobject, jint jt1, jint jt2) { return jt1*jt2; } |
|
xgene
2008-07-31
jni你转换的?
|
|
lipogem
2008-07-31
对自己转换的
还有就是用c#调用d写的dll有时也会出现问题 |