fork download
  1. #include <stdio.h>
  2.  
  3. #include <gmp.h>
  4.  
  5. extern "C" {
  6. // SPOJ, codechef, ideone (64-bit)
  7. const char* gmp_path = "/usr/lib64/libgmp.so.3";
  8. void* __libc_dlopen_mode(const char* x, int y);
  9. void* __libc_dlsym(void* x, const char* y);
  10. #define DLOPEN __libc_dlopen_mode
  11. #define DLSYM __libc_dlsym
  12. }
  13. void* p = DLOPEN(gmp_path, 2);
  14. void* get(const char* name) { return DLSYM(p, name); }
  15. int main() {
  16. printf("%i", p == nullptr);
  17. //const auto f = (decltype(mpz_init)*) get("__gmpz_init");
  18. mpz_t v;
  19. //f(v);
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0.01s 5276KB
stdin
Standard input is empty
stdout
1