#include <cv.h>
#include <dlfcn.h>

CvScalar cvTrace(const CvArr* mat) {
    void *fptr;
    CvScalar retval, *temp;

    fptr = dlsym(_Chcv_handle, "cvTrace_chdl");
    if(fptr == NULL) {
        fprintf(_stderr, "Error: %s(): dlsym(): %s\n", __func__,  dlerror());
        return retval;
    }
    dlrunfun(fptr, &temp,cvTrace, mat);
    retval=*temp;
    free(temp);
    return retval;
}
