-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdummyproc.cpp
More file actions
39 lines (30 loc) · 821 Bytes
/
dummyproc.cpp
File metadata and controls
39 lines (30 loc) · 821 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include "Library/dummylib.hpp"
int main()
{
void *libHandle = dlopen("./dummylib.so", RTLD_LAZY);
if (!libHandle)
{
fprintf(stderr, "Failed to load library: %s\n", dlerror());
return 1;
}
void *factoryPtr = dlsym(libHandle, "CreateTestClass");
if (!factoryPtr)
{
fprintf(stderr, "Failed to find factory function: %s\n", dlerror());
return 1;
}
ITestInterface *(*factory)() = (ITestInterface *(*)()) factoryPtr;
ITestInterface *test = factory();
while (true)
{
int i = test->TestMethod(1, 2);
printf("TestMethod(1, 2) returned: %d\n", i);
printf("Press any key to run TestMethod again...\n");
getchar();
}
delete test;
return 0;
}