Back to index

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

Go to the source code of this file.

Functions

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}/testobj1.so", RTLD_LAZY);
  if (h == NULL)
    error (EXIT_FAILURE, 0, "while loading `%s': %s", "testobj1.so",
          dlerror ());

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

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

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

  return res != 42;
}

Here is the call graph for this function: