C:
					
typedef struct Example3Struct {
	int val;
} Example3Struct;
...
void example3_sendStruct(const Example3Struct* sval)
{
	printf("(C) %d\n", sval->val);
}

java:

public interface CLibrary extends Library {
      //java bean 继承Structure 
	public static class Example3Struct extends Structure {
		public static class ByReference extends Example3Struct implements Structure.ByReference {}
		
		public int val;
	}
	...
	//调用动态库,传入结构体
	public void example3_sendStruct(Example3Struct.ByReference sval);
}
...
CLibrary clib = (CLibrary)Native.loadLibrary("testlib", CLibrary.class);
...
CLibrary.Example3Struct.ByReference e3ref = new CLibrary.Example3Struct.ByReference();
e3ref.val = 7;
clib.example3_sendStruct(e3ref);

//www.sitcoder.com



	
色迷迷 哭 呕吐 大笑 口水 微笑 啵一个 发怒

Hi,您需要填写昵称和邮箱!

  • 必填项
  • 必填项