def store_instance(object, attachment_method = nil)
object.impl.instance_eval { @proton_wrapper = object }
registry_key = get_key(object.impl)
unless attachment_method.nil?
record = Cproton.__send__(attachment_method, object.impl)
rbkey = Cproton.Pn_rbkey_new
Cproton.Pn_rbkey_set_registry(rbkey, Cproton.pn_rb2void(Qpid::Proton::Util::Wrapper.registry))
Cproton.Pn_rbkey_set_method(rbkey, "delete")
Cproton.Pn_rbkey_set_key_value(rbkey, registry_key)
Cproton.pn_record_def(record, RBCTX, Cproton.Pn_rbkey__class());
Cproton.pn_record_set(record, RBCTX, rbkey)
end
Qpid::Proton::Util::Wrapper.registry[registry_key] = object
end