File: load_lib.cc

package info (click to toggle)
obs-gradient-source 0.3.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 476 kB
  • sloc: ansic: 411; makefile: 22; cpp: 16
file content (24 lines) | stat: -rw-r--r-- 406 bytes parent folder | download | duplicates (54)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Thanks to Marcos Talau, 2021

#include <iostream>
#include <dlfcn.h>

using namespace std;

int main(int argc, char **argv) {
    void* handle;

    if (argc != 2) {
        cout << "Usage: " << argv[0] << " some_lib.so" << endl;
        exit(1);
    }

    handle = dlopen(argv[1], RTLD_LAZY);

    if (!handle) {
        cout << "ERROR: " << dlerror() <<  endl;
        exit(1);
    }

    exit(0);
}