mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-17 07:59:48 +02:00
21 lines
393 B
C
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;
|
|
}
|