Index: src/include/eina_module.h
===================================================================
--- src/include/eina_module.h	(리비전 69729)
+++ src/include/eina_module.h	(작업 사본)
@@ -340,6 +340,19 @@ EAPI Eina_Module *
  eina_module_find(const Eina_Array *array, const char *module) EINA_ARG_NONNULL(1, 2);
 
 /**
+ * @brief Make sure that the module never be unloaded.
+ *
+ * @param module The module.
+ *
+ * This function makes that the module never be unloaded
+ * even if the module is closed or freed.
+ * If you load the module with the same file name,
+ * already resident module will be used.
+ */
+EAPI void
+ eina_module_resident(Eina_Module *module);
+
+/**
  * @}
  */
 
Index: src/lib/eina_module.c
===================================================================
--- src/lib/eina_module.c	(리비전 69729)
+++ src/lib/eina_module.c	(작업 사본)
@@ -67,6 +67,7 @@ void *alloca (size_t);
 #include "eina_error.h"
 #include "eina_file.h"
 #include "eina_log.h"
+#include "eina_hash.h"
 
 /* undefs EINA_ARG_NONULL() so NULL checks are not compiled out! */
 #include "eina_safety_checks.h"
@@ -81,6 +82,7 @@ void *alloca (size_t);
  */
 
 static int EINA_MODULE_LOG_DOM = -1;
+static Eina_Hash *resident_modules;
 #ifdef ERR
 #undef ERR
 #endif
@@ -111,6 +113,7 @@ struct _Eina_Module
 {
    void *handle;
    int ref;
+   Eina_Bool resided : 1;
    const char file[];
 };
 
@@ -245,6 +248,7 @@ eina_module_init(void)
         return EINA_FALSE;
      }
 
+   if (!resident_modules) resident_modules = eina_hash_string_small_new(NULL);
 #define EEMR(n) n = eina_error_msg_static_register(n ## _STR)
    EEMR(EINA_ERROR_WRONG_MODULE);
    EEMR(EINA_ERROR_MODULE_INIT_FAILED);
@@ -270,6 +274,8 @@ eina_module_shutdown(void)
    /* TODO should we store every module when "new" is called and
     * delete the list of modules here
     */
+   eina_hash_free(resident_modules);
+   resident_modules = NULL;
 
    eina_log_domain_unregister(EINA_MODULE_LOG_DOM);
    EINA_MODULE_LOG_DOM = -1;
@@ -302,6 +308,7 @@ EAPI Eina_Module *eina_module_new(const
    memcpy((char *)m->file, file, len + 1);
    m->ref = 0;
    m->handle = NULL;
+   m->resided = EINA_FALSE;
    DBG("m=%p, file=%s", m, file);
 
    return m;
@@ -334,6 +341,14 @@ EAPI Eina_Bool eina_module_load(Eina_Mod
    if (m->handle)
       goto loaded;
 
+   m->handle = eina_hash_find(resident_modules, m->file);
+   if (m->handle)
+     {
+        DBG("Resident module is loaded: %s", m->file);
+        m->resided = EINA_TRUE;
+        return EINA_TRUE;
+     }
+
    dl_handle = dlopen(m->file, RTLD_NOW);
    if (!dl_handle)
      {
@@ -377,6 +392,16 @@ EAPI Eina_Bool eina_module_unload(Eina_M
 
    DBG("m=%p, handle=%p, file=%s, refs=%d", m, m->handle, m->file, m->ref);
 
+   if (m->resided)
+     {
+        if (!eina_hash_find(resident_modules, m->file))
+          {
+             eina_hash_add(resident_modules, m->file, m->handle);
+             DBG("This module is a resident now: %s", m->file);
+          }
+        return EINA_TRUE;
+     }
+
    m->ref--;
    if (!m->ref)
      {
@@ -602,3 +627,9 @@ EAPI void eina_module_list_free(Eina_Arr
 
    eina_array_flush(array);
 }
+
+EAPI void eina_module_resident(Eina_Module *m)
+{
+   EINA_SAFETY_ON_NULL_RETURN(m);
+   m->resided = EINA_TRUE;
+}
Index: ChangeLog
===================================================================
--- ChangeLog	(리비전 69729)
+++ ChangeLog	(작업 사본)
@@ -241,3 +241,7 @@
 2012-03-16  Raphael Kubo da Costa
 
 	* Adjust Valgrind's CFLAGS to fix the build when it is in a non-default location.
+
+2012-03-30  Tae-Hwan Kim
+
+	* Add eina_module_resident.
Index: NEWS
===================================================================
--- NEWS	(리비전 69729)
+++ NEWS	(작업 사본)
@@ -20,6 +20,7 @@ Additions:
     * eina_*buf_manage_new_length.
     * EINA_C_ARRAY_LENGTH macro.
     * Eina_Stringshare typedef.
+    * eina_module_resident
 
 Fixes:
 
