Some things I do. Little snippets of peoples homework and such are here: http://scottn.us/code/
I've been messing with awk a lot lately. Some is in the code directory, but the big one is my twitter client. odd, huh? :)
lot of stuffs to learn in that. http://scottn.us/bot.php
all: main module main: main.c $(CC) $(CFLAGS) -o main main.c -ldl module: module.c $(CC) $(CFLAGS) -shared -o module.o module.c clean: -rm -f main module.o
struct s_cmd { char *text; void (*func)(); };
#include <stdio.h> #include <dlfcn.h> #include "common.h" int main(int argc, char **argv) { void *dll; struct s_cmd *c; void (*func)(); dll = dlopen("./module.o", RTLD_LAZY); if (!dll) { fputs(dlerror(), stderr); return -1; } c = dlsym(dll, "__exports"); if (!c) { fputs("No __exports?\n", stderr); return -1; } while (c->text) { printf("my_command = [%s]\n", c->text); c->func(); c++; } return 0; }