glib question regarding libmoduletestplugin_a.c



Hi all,

I'm getting a type-punning warning from gcc when it processes the file libmoduletestplugin_a.c and gets to the function gplugin_a_module_func

This is cleared up if I change the function to the following:

G_MODULE_EXPORT void
gplugin_a_module_func (GModule *module)
{
  gpointer (*f) (void) = NULL;


  if (!g_module_symbol (module, "gplugin_say_boo_func", (gpointer *)f))
    {
      g_print ("error: %s\n", g_module_error ());
      exit (1);
    }


  f ();
}

It *was*:

G_MODULE_EXPORT void
gplugin_a_module_func (GModule *module)
{
  void (*f) (void) = NULL;


  if (!g_module_symbol (module, "gplugin_say_boo_func", (gpointer *) &f))
    {
      g_print ("error: %s\n", g_module_error ());
      exit (1);
    }


  f ();
}

If I may ask: was there a reason to use void (*f) instead of gpointer (*f)? Am I missing something here?

If not - do you think I should submit a patch? It would remove the warning...

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]