On Tue, 01 May 2012, tobi wrote:
> Hi,
> 
> I promptly get a segfault when I try to create an instance of my extended 
> Variant[]:
> 
> .src/Variant[].class
> --8<---------
> ' Gambas class file
> 
> Export
> 
> Public Sub _compare(hV As Variant[]) As Integer
>   Return 0
> End
> --8<---------
> 
> .src/MMain.module
> --8<---------
> ' Gambas module file
> 
> Public Sub Main()
>   Dim hV As New Variant[]
> End
> --8<---------
> 
> I hope that it's possible to override native classes?
> 
> Regards,
> Tobi

Oh, I should look first and then post...
Segfault comes from
gbx_class.c:1358:
        array_type->array_class = class;
but before that in the same function:
        CLASS *array_type = (CLASS *)class->array_type;
and look at:
(gdb) print class->array_type
$2 = 12

which is GB_T_VARIANT, as supposed to be since I exported a Variant[].
I think creating that as a pointer is a bug. (Creating arrays of native 
datatypes not expected?)

The article about Gambas object model says that gb.qt Application extends gb 
Application so, I am
allowed to extend native classes!

Regards,
Tobi

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to