diff --git a/inc/lektor/module/module_sdl2.h b/inc/lektor/module/module_sdl2.h
index 341bf6444644cfa59c9f2b4911ddb1e6b3208ed7..cdd608ebecf25ed502611897671e74eedef08bd8 100644
--- a/inc/lektor/module/module_sdl2.h
+++ b/inc/lektor/module/module_sdl2.h
@@ -4,8 +4,10 @@
 #include <sqlite3.h>
 #include <lektor/window.h>
 
+#if defined(__STATIC_MODULES)
 /* The only function with a setted filename */
 int load_sdl2(void *mod, struct lkt_state *srv, void *handle);
+#endif
 
 /* Below there are needed functions for a window module.
  * Names are not fixed but they follow a convention (to get a code easy
diff --git a/inc/lektor/module/module_x11.h b/inc/lektor/module/module_x11.h
index b6dc05df1598438d268b9e5ede530f40d48effce..f1cee93fa8e685b08a7ba9d5865576cff366a3dd 100644
--- a/inc/lektor/module/module_x11.h
+++ b/inc/lektor/module/module_x11.h
@@ -4,8 +4,10 @@
 #include <sqlite3.h>
 #include <lektor/window.h>
 
+#if defined(__STATIC_MODULES)
 /* The only function with a setted filename */
 int load_x11(void *mod, struct lkt_state *srv, void *handle);
+#endif
 
 /* Below there are needed functions for a window module.
  * Names are not fixed but they follow a convention (to get a code easy
diff --git a/meson.build b/meson.build
index 7a1ea671d22e459994ebe782e6dd2e727de9442c..d3a1af2027754a1fab4de39f63da1c8dec346157 100644
--- a/meson.build
+++ b/meson.build
@@ -27,6 +27,17 @@ if archi == 'unknown'
 endif
 add_global_arguments('-D_REENTRANT', '-D' + archi + '_ARCH', language: 'c')
 
+## Static modules ?
+if get_option('static_modules').enabled()
+  add_global_arguments('-D__STATIC_MODULES', language: 'c')
+  if get_option('module_sdl').enabled()
+    add_global_arguments('-D__STATIC_SDL2', language: 'c')
+  endif
+  if get_option('module_x11').enabled()
+    add_global_arguments('-D__STATIC_X11', language: 'c')
+  endif
+endif
+
 ## Module list
 lektor_modules = []
 
diff --git a/src/config.c b/src/config.c
index f22b715677ae69231627144f4af144c635ef4347..44008e7d79b0928a38a15265651f441fc31e8355 100644
--- a/src/config.c
+++ b/src/config.c
@@ -129,7 +129,7 @@ load_so(const char *const mod_path, const char *const mod_init, void *mod, struc
     if (module_set_function)
         return module_set_function(mod, srv, handle);
     else {
-        LOG_ERROR_SCT("LOAD", "Failed to find init symbol %s", mod_init);
+        LOG_ERROR_SCT("LOAD", "Failed to find init symbol %s in file %s", mod_init, mod_path);
         return 1;
     }
 }
diff --git a/src/main/server.c b/src/main/server.c
index 12cca8a78a96d6006f7582589d24594abe23cd9d..86be43bdd2a26b7035652aa7a957ec865d1e6ad3 100644
--- a/src/main/server.c
+++ b/src/main/server.c
@@ -18,11 +18,20 @@
 #include <pwd.h>
 #include <pthread.h>
 
+#ifdef __STATIC_SDL2
+#include <lektor/module/module_sdl2.h>
+#endif
+#ifdef __STATIC_X11
+#include <lektor/module/module_x11.h>
+#endif
+
 REG_BEGIN(server_reg)
 REG_ADD(load_repo_https)
 #ifdef __STATIC_SDL2
-#include <lektor/module/module_sdl2.h>
-REG_ADD(module_sdl2_new)
+REG_ADD(load_sdl2)
+#endif
+#ifdef __STATIC_X11
+REG_ADD(load_x11)
 #endif
 REG_END()
 
diff --git a/src/module/module_sdl2.c b/src/module/module_sdl2.c
index 5e0f0a0ec5a7e43020a980b6bc65ae262ad48f0c..101ab1a801e7cf43853eed5c421dc60b3d95f567 100644
--- a/src/module/module_sdl2.c
+++ b/src/module/module_sdl2.c
@@ -255,10 +255,14 @@ loop:
 
 /* Exported functions */
 
-extern int
+int
+#if ! defined(__STATIC_MODULES)
 module_set_function(void *arg__, struct lkt_state *srv, void *handle__)
+#else
+load_sdl2(void *arg__, struct lkt_state *srv, void *handle__)
+#endif
 {
-    RETURN_UNLESS(arg__ && handle__, "Invalid argument", 1);
+    RETURN_UNLESS(arg__, "Invalid argument", 1);
     struct lkt_win *win = (struct lkt_win *) arg__;
     win->srv            = srv;
 
@@ -276,12 +280,6 @@ module_set_function(void *arg__, struct lkt_state *srv, void *handle__)
     return !module_sdl2_new(&srv->win);
 }
 
-int
-load_sdl2(void *arg, struct lkt_state *srv, void *handle)
-{
-    return module_set_function(arg, srv, handle);
-}
-
 bool
 module_sdl2_new(struct lkt_win *const win)
 {
diff --git a/src/module/module_x11.c b/src/module/module_x11.c
index d901ec8de8e0a639ce7b91e23a0244f655fe3bca..17c67093a8fdc01fce2027aa61645ed7eaa371cd 100644
--- a/src/module/module_x11.c
+++ b/src/module/module_x11.c
@@ -42,10 +42,14 @@ struct module_x11_window {
  * NOW: THE ONLY EXPORTED FUNCTION :NOW
  */
 
-extern int
+int
+#if ! defined(__STATIC_MODULES)
 module_set_function(void *arg__, struct lkt_state *srv, void *handle__)
+#else
+load_x11(void *arg__, struct lkt_state *srv, void *handle__)
+#endif
 {
-    RETURN_UNLESS(arg__ && handle__, "Invalid arguments", 1);
+    RETURN_UNLESS(arg__, "Invalid arguments", 1);
     struct lkt_win *win = (struct lkt_win *) arg__;
     win->srv            = srv;
 
@@ -63,12 +67,6 @@ module_set_function(void *arg__, struct lkt_state *srv, void *handle__)
     return !module_x11_new(&srv->win);
 }
 
-int
-load_x11(void *arg, struct lkt_state *srv, void *handle)
-{
-    return module_set_function(arg, srv, handle);
-}
-
 /*
  *
  * NOW: PRIVATE X11 FUNCTIONS :NOW
diff --git a/src/reg.c b/src/reg.c
index c19c03913a6ff661766552caf4f7e18f8be0209a..69bc8afa6850de3aa40dcdf4e232de8cd6ddb1ab 100644
--- a/src/reg.c
+++ b/src/reg.c
@@ -21,6 +21,7 @@ reg_pick(const char *file, void **handle, const char *symbol)
         goto use_reg;
 
     /* Use dlsym */
+    LOG_INFO_SCT("REG", "Using dlfcn to find %s", symbol);
     char *error;
     *handle = dlopen(file, RTLD_NOW);
 
@@ -41,13 +42,12 @@ reg_pick(const char *file, void **handle, const char *symbol)
 
     /* Read the reg */
 use_reg:
-    for (i = 0; reg[i].name && reg[i].func && !STR_MATCH(reg[i].name, symbol); ++i)
-        continue;
+    LOG_INFO_SCT("REG", "Using the reg structure to find %s", symbol);
+    for (i = 0; reg[i].name && reg[i].func; ++i)
+        if(STR_MATCH(reg[i].name, symbol))
+            return (void *) reg[i].func;
 
-    if (reg[i].func)
-        return (void *) reg[i].func;
-    else
-        return NULL;
+    return NULL;
 }
 
 void