summarylogtreecommitdiffstats
path: root/get_cdm_version.c
blob: ac77bd7cf05a17e916537247fd3d418ba41d473d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

int main(int argc, char *argv[]) {
  void *handle;
  const char *(*get_cdm_version)();

  handle = dlopen("./libwidevinecdm.so", RTLD_LAZY);
  if (!handle) {
    fprintf(stderr, "%s\n", dlerror());
    exit(EXIT_FAILURE);
  }

  get_cdm_version = dlsym(handle, "GetCdmVersion");
  if (!get_cdm_version) {
    fprintf(stderr, "%s\n", dlerror());
    exit(EXIT_FAILURE);
  }

  printf("%s\n", get_cdm_version());
  dlclose(handle);
  exit(EXIT_SUCCESS);
}