/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
#ifndef _PTFUN4_H_
#define _PTFUN4_H_

typedef int(*funcHandle)(float, int);
int ptfun4_setHandle(int i, funcHandle);
funcHandle ptfun4_getHandle(int i);

/* below is added only for Ch */
#include <dlfcn.h>
void *_Chptfun_handle = dlopen("libptfun.dl", RTLD_LAZY);
if(_Chptfun_handle== NULL) {
   printf("Error: %s(): dlopen(): %s\n", __func__, dlerror());
   exit(-1);
} 

/* initialize and set static function pointer array */
void *_fptr = dlsym(_Chptfun_handle, 
                     "ptfun4_setgetHandles_init");
if(_fptr == NULL)  {
   printf("Error: %s(): dlsym(): %s\n", __func__, dlerror());
   return -1;
}
dlrunfun(_fptr, NULL, NULL);

/* to close dl */
void _dlclose_ptfun4(void) {
   dlclose(_Chptfun_handle);
}
atexit(_dlclose_ptfun4);

#pragma importf <ptfun4.chf>
#endif /* _PTFUN4_H_ */

