I am using polymake library in my c++ application and I encounter a problem when trying to call script (for example "gc_closure") within c++ code.
Code: Select all
#include <polymake/Main.h>
#include <polymake/Matrix.h>
#include <polymake/SparseMatrix.h>
#include <polymake/Rational.h>
using namespace polymake;
int main(int argc, const char* argv[]) {
try {
Main pm;
pm.set_application("polytope");
perl::Object p("Polytope<Rational>");
perl::Object pp("Polytope<Rational>");
int m=3; int n=3;
polymake::Matrix<Rational> mat(m,n);
polymake::Rational* elem = concat_rows(mat).begin();
Rational values[] = {1,1,0, 1,3,0, 1,2,1.5};
for(int i = 0; i<m*n; ++i) {
*(elem+i) = *(values+i);
}
p.take("VERTICES") << mat ;
pp = CallPolymakeFunction("script", "gc_closure", p);
} catch (const std::exception& ex) {
std::cerr << "ERROR: " << ex.what() << endl; return 1;
}
return 0;
}
When running interactive polymake from shell, there is no problem and scripts are working as expected.
Do I need to modify standard compilation process of my c++ application somehow in order to be able to use scripts? Do you have any suggestion?
Thank you very much.
Peter