main.c ========== #include #include #include #include int main (){ gchar *string = "Hello World!\n"; printf("%s", string); gchar *path; path = g_module_build_path("", "test"); printf("The Path: %s\n\n", path); if ( g_module_supported() == TRUE ) { GModule *mod = (GModule *)g_module_open("lib.so", G_MODULE_BIND_LAZY); void (*foo_func)(); g_module_symbol(mod, "foo", (gpointer)foo_func); foo_func(); } return 0; } lib.c ========== #include #include void foo(){ printf("FOO! \n"); } int main(){ printf("I ran?\n\n"); return 0; } Copmiled by: ============ #!/bin/bash gcc -Wall -fPIC -c lib.c gcc -shared -o libtest.so lib.o gcc -Wall -g `pkg-config --cflags glib-2.0 gmodule-2.0 --libs glib-2.0 gmodule-2.0` main.c -o run chmod +x run