/***********************************************************************/ /* midaco.h - the C interface of MIDACO 7 -------------------------------------- ONE INTEGER TYPE FOR EVERY INTEGER ARGUMENT: midaco_int = int. MIDACO takes every integer (O, N, NI, M, ME, P, IFLAG, ISTOP, LRW, LIW, LPF, MAXEVAL and the workspace IW) by reference, i.e. through a pointer. What matters is therefore not the range of a value but the WIDTH of the variable: caller and library must use exactly the same one. 'int' is 4 bytes on Windows, Linux and Mac - the width of Fortran INTEGER - while 'long' is 4 bytes on Windows and 8 bytes on Linux and Mac. So: - declare every integer you hand to MIDACO as midaco_int, - size the integer workspace as liw = sizeof(iw)/sizeof(midaco_int); - never use 'long' (or 'long int') for MIDACO arguments. Include this header in your own program (see the examples) and the compiler checks every call against these prototypes. */ /***********************************************************************/ #ifndef MIDACO_H #define MIDACO_H #ifndef MIDACO_INT_DEFINED #define MIDACO_INT_DEFINED typedef int midaco_int; /* 4 bytes, the width of Fortran INTEGER */ #endif #ifdef __cplusplus extern "C" { #endif /* The solver - one call per block of P evaluated candidates. maxeval is the evaluation budget of the run (the value given to midaco_print), by reference like every integer; 0 = not known */ int midaco( midaco_int *p, midaco_int *o, midaco_int *n, midaco_int *ni, midaco_int *m, midaco_int *me, double *x, double *f, double *g, double *xl, double *xu, midaco_int *iflag, midaco_int *istop, double *param, double *rw, midaco_int *lrw, midaco_int *iw, midaco_int *liw, double *pf, midaco_int *lpf, midaco_int *maxeval, char *key ); /* The printing routine: c = 1 before the loop, c = 2 after each call */ int midaco_print( midaco_int c, midaco_int printeval, midaco_int save2file, midaco_int resumable, midaco_int *iflag, midaco_int *istop, double *f, double *g, double *x, double *xl, double *xu, midaco_int o, midaco_int n, midaco_int ni, midaco_int m, midaco_int me, double *rw, midaco_int lrw, midaco_int *iw, midaco_int liw, double *pf, midaco_int maxeval, midaco_int maxtime, double *param, midaco_int p, char *key ); /* The exact workspace lengths LRW and LIW for a given problem and P */ int midaco_ws( midaco_int *p, midaco_int *o, midaco_int *n, midaco_int *ni, midaco_int *m, midaco_int *lrw, midaco_int *liw ); #ifdef __cplusplus } #endif #endif