/* Returns: (transfer none): the #GTypePlugin for the dynamic interface @interface_type of @instance_type  */
GTypePlugin* g_type_interface_get_plugin(GType instance_type, GType interface_type)
/* Returns: (transfer none): the #GTypePlugin for the dynamic interface @interface_type of @instance_type  */
GTypePlugin* g_type_interface_get_plugin(GType instance_type, GType interface_type)
{
  TypeNode *node;
  TypeNode *iface;
  g_return_val_if_fail (G_TYPE_IS_INTERFACE (interface_type), NULL);
  node = lookup_type_node_I (instance_type);  
  iface = lookup_type_node_I (interface_type);
  if (node && iface)
    {
      IFaceHolder *iholder;
      GTypePlugin *plugin;
      G_READ_LOCK (&type_rw_lock);
      iholder = iface_node_get_holders_L (iface);
      while (iholder && iholder->instance_type != instance_type)
	iholder = iholder->next;
      plugin = iholder ? iholder->plugin : NULL;
      G_READ_UNLOCK (&type_rw_lock);
      return plugin;
    }
  g_return_val_if_fail (node == NULL, NULL);
  g_return_val_if_fail (iface == NULL, NULL);
  g_warning (G_STRLOC ": attempt to look up plugin for invalid instance/interface type pair.");
  return NULL;
}