bump version
[barvinok.git] / count_domain.c
blob81c4f84c4368711d59750e85e76a04be2547e29b
1 #include <assert.h>
2 #include <dlfcn.h>
3 #include "ev_operations.h"
4 #include "barvinok.h"
6 /* gcc -shared count_domain.c -rdynamic -o libcount.so -ldl -lc */
8 evalue* barvinok_enumerate_ev(Polyhedron *P, Polyhedron* C, unsigned MaxRays)
10 static evalue *(*orig)(Polyhedron *, Polyhedron *c, unsigned) = NULL;
11 evalue *res;
12 int c;
14 if (!orig) {
15 void *handle = dlopen("libbarvinok.so", RTLD_LAZY);
16 assert(handle);
17 orig = dlsym(handle, "barvinok_enumerate_ev");
18 assert(orig);
19 dlclose(handle);
22 res = orig(P, C, MaxRays);
24 c = value_notzero_p(res->d) ? 0
25 : res->x.p->type == partition ? res->x.p->size/2 : 1;
26 fprintf(stderr, "COUNT: %d %d %d %d\n", P->Dimension,
27 C->Dimension, c, P->Dimension - P->NbEq/*, domain_size(P)*/);
29 return res;