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

typedef void (*funcHandle)(float, int);
int ptfun3_setHandle(int num, funcHandle funptr);
funcHandle ptfun3_getHandle(int num);

/* below is added 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, "ptfun3_setgetHandles_init");
if(_fptr == NULL)  {
   printf("Error: %s(): dlsym(): %s\n", __func__, dlerror());
   exit(-1);
}
dlrunfun(_fptr, NULL, NULL);

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

#pragma importf <ptfun3.chf>
#endif /* _PTFUN3_H_ */
