1 /* prog_gnu_dynlinker.c -- check that RTLD_NEXT is defined as in GNU linker */
2 /* Copyright (c) 2012-2014. The SimGrid Team.
3 * All rights reserved. */
5 /* This program is free software; you can redistribute it and/or modify it
6 * under the terms of the license (GNU LGPL) which comes with this package. */
14 static void * (*real_malloc) (size_t);
18 dlerror(); // clear any previous error
19 real_malloc = (void * (*) (size_t)) dlsym(RTLD_NEXT, "malloc");
21 if (!error && real_malloc) {
22 char *A = real_malloc(20);
23 strcpy(A,"epic success");
28 printf("Error while checking for dlsym: %s\n",error);
30 printf("dlsym did not return any error, but failed to find malloc()\n");