You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
422 B
C
23 lines
422 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <dlfcn.h>
|
|
#include "plugin.h"
|
|
|
|
int main( void ) {
|
|
int ret = EXIT_FAILURE;
|
|
void* lib = dlopen( "./plugin.so", RTLD_LAZY|RTLD_LOCAL );
|
|
void* sym = NULL;
|
|
plugin f;
|
|
if( !lib || !(sym = dlsym( lib, PLUGIN )) ) {
|
|
fprintf( stderr, "ERROR: %s\n", dlerror() );
|
|
goto error;
|
|
}
|
|
f = (plugin)sym;
|
|
ret = f();
|
|
error:
|
|
if( lib )
|
|
dlclose( lib );
|
|
return ret;
|
|
}
|
|
|