3 ms·
diff --git a/hello.c b/hello.c index 725d5ec..b7b1745 100644 --- a/hello.c +++ b/hello.c @@ -1,3 +1,5 @@ +#define _GNU_SOURCE +#include <dlfcn.h>
by glandium 8y ago
diff --git a/hello.c b/hello.c
index 725d5ec..b7b1745 100644
--- a/hello.c
+++ b/hello.c
@@ -1,3 +1,5 @@
+#define _GNU_SOURCE
+#include <dlfcn.h>
#include <stdio.h>
#include "newplus/plus.h"
@@ -7,8 +9,9 @@ void run(int count)
long long end;
int x = 0;
+ int (*_plusone)(int) = dlsym(RTLD_DEFAULT, "plusone");
while (x < count)
- x = plusone(x);
+ x = _plusone(x);
printf("%lld\n", current_timestamp() - start);
}
And you need to add -ldl to the link flags.
Edit: but yeah, -fno-plt works too.