[Gambas-devel] Returning a reference to an array ...

Benoit Minisini gambas at ...1...
Mon Jan 12 17:14:16 CET 2009


On lundi 12 janvier 2009, Gareth Bult wrote:
> Hi,
>
> I inserted your code to start with just replacing <<number of devices>> ...
> I get;
>
> iax2.c:455: warning: passing argument 2 of 'GB.Array.New' makes integer
> from pointer without a cast iax2.c:459: warning: dereferencing 'void *'
> pointer
> iax2.c:459: error: invalid use of void expression
> iax2.c:460: error: void value not ignored as it ought to be
>
> When compiling ..
>
> GB.Array.New seems to be expecting a GB_T constant , whereas GB.FindClass
> is returning a pointer (???)
>
> So whereas I would love to use;
>
> #GB.Array.New(&array, GB.FindClass("IAX2Device"), <<number of devices>>);
>
> It seems this option is not available .. which is why I was using;
>
> #GB.Array.New(&array,GB_T_OBJECT,ndevs);
>
> Help!
>
> Gareth.
>

I forgot a cast.

GB.Array.New(&array, (GB_TYPE)GB.FindClass("IAX2Device"), <<number of 
devices>>);

You can use GB_T_OBJECT. But now you can have specialized arrays in Gambas, so 
why not using them? :-)

-- 
Benoit Minisini




More information about the Devel mailing list