fpc/docs/progex/ctest2.c
2000-06-15 19:05:55 +00:00

21 lines
393 B
C

#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;
}