Re: [Vala] binding help



Hi Matías,

On Thu, 2008-05-08 at 02:12 -0300, Matías De la Puente wrote:
I need to make a binding for a library for the next hypotetical
function:

int library_function (Data x);

Data is an structure, for example:

typedef struct Data 
{
    int value1;
    int value2;
};

In a vapi file i put this lines (the structure is also in the vapi):
namespace Library
{
    [CCode (cname = "library_function")
    public int function(Data x);
}

valac gives in the c source:

library_function(&x);

I want to know how to implement this because i need in the c source:

library_funcion(x);

Struct values are passed by reference by default as that's common in C
for most structs. If you have a struct that is passed by value, you can
specify that with the SimpleType attribute, for example

[SimpleType]
public struct Data {
        public int value1;
        public int value2;
}

Jürg




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