【发布时间】:2011-10-08 10:23:26
【问题描述】:
我需要使用“接口”在 Java 中实现回调函数。我将应用程序部分写为MyJavaFunction(int size, m_GetSizeInterface);
m_GetSizeInterface 是一个包含回调函数 GetSize 的接口。此 GetSize 方法在应用程序中被覆盖。在 JNI 中,我需要调用具有原型 int MyCPPFunction(int size, int (*callback)(int* ID)); 的 CPP 函数
如何将此 GetSize 作为参数传递给 JNI 中的 MyCPPFunction?请帮忙
public int GetSize (m_SizeClass arg0)
{
g_size = arg0.size;
return 0;
}
【问题讨论】:
标签: java interface callback java-native-interface function-pointers