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