Back to index

glibc  2.9
origtest.c File Reference
#include <dlfcn.h>
#include <error.h>
#include <stdio.h>
#include <stdlib.h>

Go to the source code of this file.


int main (void)
int foo (int a)

Function Documentation

int foo ( int  a)
int main ( void  )

Definition at line 7 of file origtest.c.

  void *h;
  int (*fp) (int);
  int res;

  h = dlopen ("${ORIGIN}/", RTLD_LAZY);
  if (h == NULL)
    error (EXIT_FAILURE, 0, "while loading `%s': %s", "",
          dlerror ());

  fp = dlsym (h, "obj1func1");
  if (fp == NULL)
    error (EXIT_FAILURE, 0, "getting `obj1func1' in `%s': %s",
          "", dlerror ());

  res = fp (10);
  printf ("fp(10) = %d\n", res);

  if (dlclose (h) != 0)
    error (EXIT_FAILURE, 0, "while close `%s': %s",
          "", dlerror ());

  return res != 42;

Here is the call graph for this function: