Re: [Vala] Problem while creating a vapi file for a typedef'd pointer.



Hi,

Geoffrey Blackman wrote:
Hi,
I'm attempting to create a vapi file for Verilog VPI and have run into a
problem with a opaque pointer type.
Different implementations of VPI define the type vpiHandle differently. Two
examples are

typedef void *vpiHandle;
I don't know if this is bindable in vala (i.e. you may need to use
typedef struct __vpiHandle *vpiHandle;
but this should be something like
[Compact]
[CCode (cname="struct __vpiHandle"]
public class Handle {...}

I therefor need to define a type in my vapi file which will map to vpiHandle
and behave like a pointer.

I'd like to explain some things here.
    [SimpleType]
SimpleType means it should be passed by value, it definietly won't behave like a pointer.
[...]
Note that the '?' indicating that the iterate method can return null has
caused argv to have type 'vpiHandle*' rather than the vpiHandle returned by
for a struct, '?' means it's boxed (that's the only way for it to be null).
vpi_iterate.
If I remove the nullable marker I would get the correct type for argv,
however I cannot now test it for null.
because a struct won't behave like a pointer.


Your best bet is a compact class, but this won't work in the void* case.

HTH,
Abderrahim



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