2

I'm writing a program using Pari and used classes to code conveniently, but it seems that Pari is not compatible with C++ classes. I made a class that had a GEN variable and initialized it using the constructor. Every time I try to access that variable, program shows a segmentation fault.
Is there a way to make it compatible with C++?
Is there a patch to add further functionality to Pari?

This is an example of the code I'm trying to run.

#include <pari/pari.h>
#include <iostream>

using namespace std;

class Test{
public:
    GEN x;

    Test(){
        x = cgetg(5, t_VEC);
        for(int i = 0; i < 5; i++)
            gel(x, i + 1) = gen_0;
    }

    void exp(){
        cout << GENtostr(x) << endl;
    }
};

int main(){
    pari_init(600000000, 2);
    Test y;
    y.exp();
    pari_close();
    return 0;
}
AdveRSAry
  • 187
  • 7

0 Answers0