Specifications

Intel
®
Image Processing Library Reference Manual
3-14
3
Example 3-1 Error Functions (continued)
/* library function */
void libFuncB(double a, int order) {
float *vec;
if (order > 31) {
IPL_ERROR(IPL_StsBadArg, "libFuncB",
"order must be less than or equal to 31");
return;
}
if ((vec = libFuncD(a, order)) == NULL) {
IPL_ERRCHK("libFuncB", "compute using a");
return;
}
/* code to do some real work goes here */
free(vec);
} // next: library function called internally
double *libFuncD(double a, int order) {
double *vec;
if ((vec=(double*)malloc(order*sizeof(double))) == NULL) {
IPL_ERROR(IPL_StsNoMem, "libFuncD",
"allocating a vector of doubles");
return NULL;
}
/* do something with vec */
return vec;
}
When the program is run, it produces the output illustrated in Example 3-2.