Re: [Vala] trying vapi file for ngspice, bool not defined



On Fri, 2014-05-16 at 14:09 +0200, Steven Vanden Branden wrote:
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?

Sounds like ngspiceshared's header file uses bool but doesn't include
stdbool.h.  Try changing your CCode annotation from cheader_filename =
"ngspiceshared.h" (or whatever the header file name is) to
cheader_filename = "stdbool.h,ngspiceshared.h".  And/or file a bug with
them.

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?

We use underscores in field names in Vala, not camelCase.  There is
nothing that says you have to follow this convention, but it will make
the API fit better with other libraries, and in this case it even
matches what the C library does.

-Evan

Attachment: signature.asc
Description: This is a digitally signed message part



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