I am using Z3 4.1 C-API on linux. I want to specify a timeout for a solver.
I am using following commands, however I get a segmentation fault in the command Z3_solver_set_params().
Z3_context ctx = mk_context();
Z3_solver s = Z3_mk_solver(ctx);
Z3_params params = Z3_mk_params(ctx);
Z3_symbol r = Z3_mk_string_symbol(ctx, ":timeout");
Z3_params_set_uint(ctx, params, r, static_cast<unsigned>(10));
Z3_solver_set_params(ctx, s, params);
It seems that I am not using APIs correctly.
I couldn't find any example for C-APIs to set a solver timeout in test_capi.c file containing examples.
Can anyone help?
You need to increment reference counts on the solver and parameters before doing anything else. Here is a snippet that will go through.