Beispiel #1
0
 private Object getValueFromNative(String type, org.bridj.Pointer pointer) {
   NativeSymbolDemangler dem = NativeSymbolDemangler.create();
   NativeType t = dem.demangleType(bundleName, type);
   if (t == null) {
     throw ex("Null native type for " + bundleName + " type " + type);
   }
   if (t.isPointer()) {
     return new NativePointer(pointer.getPointerAtOffset(0), t);
   }
   if (t.isCompound()) {
     throw ex("Unsupported direct stuct passing (use pointer or references): " + t.toString());
   }
   // could find a way to reuse jna mapping but I didn't managed to :(
   try {
     return nativeInterpreters.get(type).interpret(pointer);
   } catch (NullPointerException ex) {
     throw ex("NPE while reading value for native type '" + type + "'", ex);
   }
 }