blob: aff2d4719769164026d2d023512f6009cd048326 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#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;
}
|