#include "ircd.h" int LoadModule(char *module,char *name,Mods *head) { Mods node; if ((node=(ModNode *)calloc(1,sizeof(ModNode)))!=NULL) { sprintf(node->ModuleName,"%s",name); printf("Loading Module: %s\n",node->ModuleName); node->handle = dlopen(module,RTLD_LAZY); if (!node->handle) { printf("%s\n", dlerror()); return(0); } node->char_ptr = dlsym(node->handle, "Description"); if (!node->char_ptr) { printf("%s\n", dlerror()); exit(0); } sprintf(node->ModuleDescription,"%s",node->char_ptr("test")); (Mods *)node->next=*head; *head = node; } return(1); } int ListModules(Mods head) { Mods t; t = head; printf("Listing Modules\n"); while (t) { printf("[%s][%s]\n",t->ModuleName,t->ModuleDescription); (Mods *)t = t->next; } return(1); }