刚学习java不久,现在要调用C写的动态库..经过一步步研究,终于搞明白了一些东西,比如jni什么的..现在需要调用的C库中有回调函数...如下#define PHONIC_API
#define CALLBACK
.....
.....
.....
typedef void (CALLBACK * ProcPhonicFireEventCallBack)(
EPhonicEvent  eventType,
         int           channelType,
int      channelID, 
int           iParam1,
int           iParam2);
//事件通知回调函数
void PHONIC_API tpi_SetEventNotifyCallBackProc(ProcPhonicFireEventCallBack procFireEvent );这些东西在java中如何native声明呢?请高手指点啊!

解决方案 »

  1.   

    public class testdll
      {
      static
      {
      System.loadLibrary("goodluck");
      }
      public native static int get();
      public native static void set(int i);
      public static void main(String[] args)
      {
      testdll test = new testdll();
      test.set(10);
      System.out.println(test.get());
      }
      }
      

  2.   

    不调C库了...现在改用tcp通讯了...这东西太不好搞了,勉强调可以后调也不好调!!送分!!