#ifndef SAMPLE_H
#define SAMPLE_H

#ifdef _CH_
/*
#pragma package <chsample>
#include <chdl.h>
LOAD_CHDL(sample)
*/
#include <dlfcn.h>
void *_Chsample_handle = dlopen("libsample.dl", RTLD_LAZY);
#pragma exec _Chsample_handle?0:                           \
   fprintf(_stderr, "Error: dlopen(): %s\n", dlerror()), \
   fprintf(_stderr, "       cannot get _Chsample_handle in sample.h\n");
void _dlclose_sample(void) {
   dlclose(_Chsample_handle);
}
atexit(_dlclose_sample);
#endif

/* func1() and func2() use sin() and hypot() in math.h */
#include <math.h> 
#include <stdio.h> 

#if defined(_WIN32)
#define EXPORT _declspec(dllexport)
#else
#define EXPORT 
#endif

EXPORT extern double func1(double x);
EXPORT extern double func2(double x, double y);

#endif /* SAMPLE_H */
