metaproxy  1.13.0
Functions
tstdl.cpp File Reference
#include "config.hpp"
#include <stdlib.h>
#include <iostream>
#include <dlfcn.h>
Include dependency graph for tstdl.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 29 of file tstdl.cpp.

30 {
31 #if HAVE_DLFCN_H
32  if (argc != 3)
33  {
34  cerr << "bad args" << endl << "Usage: tstdl filename symbol" << endl;
35  exit(1);
36  }
37  void *mod = dlopen(argv[1][0] ? argv[1] : 0, RTLD_NOW|RTLD_LOCAL);
38  if (!mod)
39  {
40  cerr << "dlopen failed for file '" << argv[1] << "'\n" <<
41  "dlerror=" << dlerror() << endl;
42  exit(1);
43  }
44  void *sym = dlsym(mod, argv[2]);
45  cout << "sym=" << sym << endl;
46  dlclose(mod);
47  exit(0);
48 #else
49  cerr << "dl lib not enabled or not supported" << endl;
50  exit(1);
51 #endif
52 
53 }