From: Steve S. <ssa...@in...> - 2008-02-21 19:26:50
|
John Lenz wrote: > This is somewhat hard to wrap. You would need to use out typemaps... but > need to combine out typemap with an argout... would be somewhat nasty. > > But an alternative is to write some helper function like so > > %inline %{ > struct MyStrArray { > int len; > MyStruct *arr; > }; > %} > > %extend MyStrArray %{ > MyStruct getItem(int i) { > if (0 <= i && i < $self->len) { > return $self->arr[i]; > } else { > return 0; > } This is making sense. Thanks. Wouldn't getItem() return a pointer though? That is, wouldn't the first two lines of the last piece above really be this? %extend% MyStrArray %{ MyStruct *getItem(int i) { ^ pointer difference -- Steve Sapovits Invite Media - http://www.invitemedia.com ssa...@in... |