[Vala] trying vapi file for ngspice, segfaults



hello,
seems like the mail got lost but anyway have read the answer on
mailarchive about the bool, got the vapi to compile but get an segment
fault error when i try to run the application so i would like to review
the vapi for the function that causes it:

#if __GNUC__ >= 4
    #define IMPEXP __attribute__ ((visibility ("default")))
    #define IMPEXPLOCAL  __attribute__ ((visibility ("hidden")))


IMPEXP
int  ngSpice_Init(SendChar* printfcn, SendStat* statfcn, ControlledExit*
ngexit, SendData* sdata, SendInitData* sinitdata, BGThreadRunning*
bgtrun, void* userData);

the arguments are almost all pointer to callback functions and these i
need to get in my vala program.

vapi code :

[CCode (cname = "ngSpice_Init")]
              public int init(out SendOutput* a,out SendSimulationStatus* b,out ControlledExit* c
              , out SendVectorData* d, out SendInitializationData* e, out IsBackgroundThreadRunning* f, out 
void * userData);
              

the code in my vala class:

                public SendOutput* a;
                public SendSimulationStatus* b ;
                public ControlledExit* c;
                public SendVectorData* d;
                public SendInitializationData* e;
                public IsBackgroundThreadRunning* f;

ngspice.init(out a,out b,out c,out d,out e,out f,null);


i am compiling the ngspice library with debug symbols now to get a
working trace to see if this is a vapi error from me or a lib problem.

greetings and thanks for the assistance,
Steven

--- Begin Message ---
hello all, 

im trying to write a vapi file for the ngspiceshared header file and
library but i got a compile error about bool not defined in the c
compiler, any thoughts?

typedef struct vecvalues {
    char* name;        /* name of a specific vector */
    double creal;      /* actual data value */
    double cimag;      /* actual data value */
    bool is_scale;     /* if 'name' is the scale vector */
    bool is_complex;   /* if the data are complex numbers */
} vecvalues, *pvecvalues;

and the corresponding vapi file entry

[CCode (cname = "vecvalues", has_destroy_function = false,
has_copy_function = false, has_type_id = false)]
        
public struct VecValues {
                public string name;        /* name of a specific vector */
                public double creal;      /* actual data value */
                public double cimag;      /* actual data value */
                [CCode (cname = "is_scale")] 
                public bool isScale;     /* if 'name' is the scale vector */
                [CCode (cname = "is_complex")]
                public bool isComplex;   /* if the data are complex numbers */
}       //vecvalues, *pvecvalues;

Is the vapi for this correct?

greets,
Steven Vanden Branden

--- End Message ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]