Blame tests/libmoduletestplugin_a.c

Packit ae235b
/* libgplugin_a.c - test plugin for testgmodule
Packit ae235b
 * Copyright (C) 1998 Tim Janik
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General Public
Packit ae235b
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 */
Packit ae235b
Packit ae235b
/*
Packit ae235b
 * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
Packit ae235b
 * file for a list of people on the GLib Team.  See the ChangeLog
Packit ae235b
 * files for a list of changes.  These files are distributed with
Packit ae235b
 * GLib at ftp://ftp.gtk.org/pub/gtk/. 
Packit ae235b
 */
Packit ae235b
Packit ae235b
#undef G_DISABLE_ASSERT
Packit ae235b
#undef G_LOG_DOMAIN
Packit ae235b
Packit ae235b
#include	<gmodule.h>
Packit ae235b
#include	<stdlib.h>
Packit ae235b
Packit ae235b
G_MODULE_EXPORT void gplugin_a_func (void);
Packit ae235b
G_MODULE_EXPORT void gplugin_clash_func (void);
Packit ae235b
G_MODULE_EXPORT void g_clash_func (void);
Packit ae235b
G_MODULE_EXPORT void gplugin_say_boo_func (void);
Packit ae235b
G_MODULE_EXPORT void gplugin_a_module_func (GModule *module);
Packit ae235b
Packit ae235b
G_MODULE_EXPORT gchar* gplugin_a_state;
Packit ae235b
Packit ae235b
G_MODULE_EXPORT void
Packit ae235b
gplugin_a_func (void)
Packit ae235b
{
Packit ae235b
  gplugin_a_state = "Hello world";
Packit ae235b
}
Packit ae235b
Packit ae235b
G_MODULE_EXPORT void
Packit ae235b
gplugin_clash_func (void)
Packit ae235b
{
Packit ae235b
  gplugin_a_state = "plugin clash";
Packit ae235b
}
Packit ae235b
Packit ae235b
G_MODULE_EXPORT void
Packit ae235b
g_clash_func (void)
Packit ae235b
{
Packit ae235b
  gplugin_a_state = "global clash";
Packit ae235b
}
Packit ae235b
Packit ae235b
G_MODULE_EXPORT void
Packit ae235b
gplugin_say_boo_func (void)
Packit ae235b
{
Packit ae235b
  gplugin_a_state = "BOOH";
Packit ae235b
}
Packit ae235b
Packit ae235b
G_MODULE_EXPORT void
Packit ae235b
gplugin_a_module_func (GModule *module)
Packit ae235b
{
Packit ae235b
  void *f = NULL;
Packit ae235b
Packit ae235b
  if (!g_module_symbol (module, "gplugin_say_boo_func", &f ))
Packit ae235b
    {
Packit ae235b
      g_print ("error: %s\n", g_module_error ());
Packit ae235b
      exit (1);
Packit ae235b
    }
Packit ae235b
Packit ae235b
  ((void(*)(void)) f) ();
Packit ae235b
}