On 30/04/2013 02:35, Marvin Humphrey wrote:
One more implementation note: Clownfish-generated host bindings cannot wrap host values for parameters which are marked as `decremented`, e.g, such as the `element` parameter passed to VA_Push():/** Push an item onto the end of a VArray. */ void Push(VArray *self, decremented Obj *element = NULL); The implementation copies the passed-in pointer directly, so it's up to the caller to manage reference counting: void VA_push(VArray *self, Obj *element) { if (self->size == self->cap) { VA_Grow(self, Memory_oversize(self->size + 1, sizeof(Obj*))); } self->elems[self->size] = element; // <-------------------- HERE self->size++; }
Good point. But it goes even further than that. What if a wrapped host language string is passed as a decremented parameter *at a later point*? It will result in the same problem, but it can't be worked around in the host bindings.
Nick
