testlib = null;
}
public void testFunctionMapper() throws Exception {
FunctionMapper mapper = StdCallLibrary.FUNCTION_MAPPER;
NativeLibrary lib = NativeLibrary.getInstance("testlib");
Method[] methods = {
TestLibrary.class.getMethod("returnInt32ArgumentStdCall",
new Class[] { int.class }),
TestLibrary.class.getMethod("returnStructureByValueArgumentStdCall",
new Class[] {
TestLibrary.TestStructure.ByValue.class
}),
TestLibrary.class.getMethod("callInt32StdCallCallback",
new Class[] {
TestLibrary.Int32Callback.class,
int.class, int.class,
}),
};
for (int i=0;i < methods.length;i++) {
String name = mapper.getFunctionName(lib, methods[i]);
assertTrue("Function name not decorated for method "
+ methods[i].getName()
+ ": " + name, name.indexOf("@") != -1);
assertEquals("Wrong name in mapped function",
name, lib.getFunction(name, StdCallLibrary.STDCALL_CONVENTION).getName());
}
}