Hi, I'm trying to convert the following Perl member functions into their Inline C equivalents:
sub add_message { my ($self, $message) = @ARG; push @{$self->{MESSAGE}}, $message; return; } sub messages { my ($self) = @ARG; if (defined $self->{MESSAGE}) { return @{$self->{MESSAGE}}; } return; } I think I have the add_message() half working correctly, but I can't seem to get the list return in messages() quite right. void add_message(SV* obj, SV* message) { Event* event = (Event*)SvIV(SvRV(obj)); av_push(event->messages, message); } void messages(SV* obj) { Event* event = (Event*)SvIV(SvRV(obj)); SV** tmp; int i, array_len; Inline_Stack_Vars; Inline_Stack_Reset; array_len = av_len(event->messages) + 1; if(array_len == 0) { Inline_Stack_Void; } else { for (i = 0 ; i < array_len ; i++) { tmp = av_fetch(event->messages, i, 0); Inline_Stack_Push(*tmp); } } Inline_Stack_Done; } Any advice? In the array_len != 0 branch, the stack is coming back uninitialized. Thanks, Scott