1234567891011121314151617181920 |
- #include <dlfcn.h>
- #include <string.h>
- int main()
- {
- void *lib;
- char *s;
- int FromPos, ToPos;
- char* (*SubStr)(const char*, int, int);
- lib = dlopen("./libsubs.so", RTLD_LAZY);
- SubStr = dlsym(lib, "SUBSTR");
- s = strdup("Test");
- FromPos = 2;
- ToPos = 3;
- printf("Result from SubStr: '%s'\n", (*SubStr)(s, FromPos, ToPos));
- dlclose(lib);
- return 0;
- }
|