public static RubyClass createAutoPointerClass(Ruby runtime, RubyModule module) {
RubyClass autoptrClass = module.defineClassUnder(AUTOPTR_CLASS_NAME,
module.getClass("Pointer"),
RubyInstanceConfig.REIFY_RUBY_CLASSES ? new ReifyingAllocator(AutoPointer.class) : AutoPointerAllocator.INSTANCE);
autoptrClass.defineAnnotatedMethods(AutoPointer.class);
autoptrClass.defineAnnotatedConstants(AutoPointer.class);
autoptrClass.setReifiedClass(AutoPointer.class);
autoptrClass.kindOf = new RubyModule.KindOf() {
@Override
public boolean isKindOf(IRubyObject obj, RubyModule type) {
return obj instanceof AutoPointer && super.isKindOf(obj, type);