New module loading scheme
authorMyhailo Danylenko <isbear@ukrpost.net>
Thu, 04 Mar 2010 19:56:16 +0200
changeset 8 2033d1c5d226
parent 7 0b869c49c807
child 9 70bb1e988a4a
New module loading scheme
CMakeLists.txt
yaubil.c
yaubil.rc
--- a/CMakeLists.txt	Mon Feb 15 19:30:25 2010 +0200
+++ b/CMakeLists.txt	Thu Mar 04 19:56:16 2010 +0200
@@ -22,10 +22,8 @@
 ## Check for build dependencies
 find_package(PkgConfig REQUIRED) 
 pkg_check_modules(GLIB REQUIRED glib-2.0) 
-pkg_check_modules(GMODULE REQUIRED gmodule-2.0) 
 pkg_check_modules(MCABBER REQUIRED mcabber)
 link_directories(${GLIB_LIBRARY_DIRS}
-				 ${GMODULE_LIBRARY_DIRS}
 				 ${MCABBER_LIBRARY_DIRS})
 
 ## Target definitions
@@ -33,10 +31,8 @@
 
 ## Compiler setup
 include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} 
-                    ${GMODULE_INCLUDE_DIRS}
                     ${MCABBER_INCLUDE_DIRS})
 target_link_libraries(yaubil ${GLIB_LIBRARIES} 
-                      ${GMODULE_LIBRARIES}
 					  ${MCABBER_LIBRARIES})
 include_directories(${yaubil_SOURCE_DIR} 
                     ${yaubil_BINARY_DIR})
--- a/yaubil.c	Mon Feb 15 19:30:25 2010 +0200
+++ b/yaubil.c	Thu Mar 04 19:56:16 2010 +0200
@@ -20,13 +20,23 @@
  */
 
 #include <glib.h>
-#include <gmodule.h>
 #include <string.h>
 
 #include <mcabber/commands.h>
 #include <mcabber/compl.h>
 #include <mcabber/logprint.h>
 #include <mcabber/settings.h>
+#include <mcabber/modules.h>
+
+static void yaubil_init   (void);
+static void yaubil_uninit (void);
+
+module_info_t info_yaubil = {
+	.mcabber_version = "0.10.0",
+	.requires        = NULL,
+	.init            = yaubil_init,
+	.uninit          = yaubil_uninit,
+};
 
 static gboolean ifresult = TRUE;
 
@@ -886,7 +896,7 @@
 		process_command (start, TRUE);
 }
 
-const gchar *g_module_check_init (GModule *module)
+static void yaubil_init (void)
 {
 	cmd_add ("multi", "", COMPL_CMD, COMPL_CMD, do_multi, NULL);
 	cmd_add ("if", "", 0, 0, do_if, NULL);
@@ -894,11 +904,9 @@
 	cmd_add ("else", "", COMPL_CMD, COMPL_CMD, do_else, NULL);
 	cmd_add ("eval", "", 0, 0, do_eval, NULL);
 	cmd_add ("let", "", 0, 0, do_let, NULL);
-
-	return NULL;
 }
 
-void g_module_unload (GModule *module)
+static void yaubil_uninit (void)
 {
 	cmd_del ("multi");
 	cmd_del ("if");
--- a/yaubil.rc	Mon Feb 15 19:30:25 2010 +0200
+++ b/yaubil.rc	Thu Mar 04 19:56:16 2010 +0200
@@ -1,3 +1,3 @@
 
-load yaubil
+module load yaubil