/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/***********************************
*  Get the Ch version infor in which Ch is installed
************************************/

#include<dlfcn.h>

void chversion() {

  void *dlhandle, *fptr;

  dlhandle = dlopen("libch.dl", RTLD_LAZY);
  if(dlhandle == NULL) {
    printf("Error: %s(): dlopen): %s\n", __func__, dlerror());
    return;
  }
  fptr = dlsym(dlhandle, "chversion_chdl");
  if(fptr == NULL) {
    printf("Error: %s(): dlsym(): %s\n", __func__, dlerror());
    return;
  }

  dlrunfun(fptr, NULL, chversion);

  if(dlclose(dlhandle)!=0) {
    printf("Error: %s(): dlclose): %s\n", __func__, dlerror());
    return;
  }

  return;
}

/*************** application *****************/

chversion();
