27 Mar, 2011, Tyche wrote in the 21st comment:
Votes: 0
No it's simple.

mud.h
void bar(void);


mud.c
#include <stdio.h>
#include <dlfcn.h>
#include "mud.h"

typedef void (*foo_t)();

int main() {
void* foo_lib = dlopen("./foo.so", RTLD_LAZY);
foo_t foo = (foo_t) dlsym(foo_lib, "foo");
bar();
foo();
}

void bar(void) {
printf("bar\n");
}


foo.c
#include <stdio.h>
#include "mud.h"

int foo() {
printf("foo\n");
bar();
}


makefile
all: mud.exe foo.so 

mud.exe: mud.o
gcc -Wl,–export-all-symbols -Wl,–out-implib=libmud.a -o $@ $^

foo.so: foo.o
gcc -shared -o $@ $^ -L./ -lmud

.c.o:
gcc -c $*.c -o $*.o


Aside: Always post warning and error messages when you request help.
20.0/21