[Parrot-users] how do I pass obj** to a C function from parrot?

Vadim Konovalov vadrer at gmail.com
Wed Dec 2 04:21:37 UTC 2009


On Monday 30 November 2009 01:03:53 Vadim Konovalov wrote:
> On Sunday 29 November 2009 13:21:04 Allison Randal wrote:
> > It looks like you can do this by calling the functions 'Tcl_NewListObj'
> > to create a new Tcl list of Tcl_Obj's, then call
> > 'Tcl_ListObjAppendElement' to add each Tcl_Obj* to the list, and then
> > call 'Tcl_ListObjGetElements' to get back a Tcl_Obj** array of the
> > elements of the list. That Tcl_Obj** array should be able to be passed
> > directly to 'Tcl_EvalObjv'.
>
> no :)

Okay, as a workaround, I've made it this way, as you've suggested.
Indeed, using Tcl_NewListObj and Tcl_ListObjAppendElement I create a proper 
list and use it for Tcl_EvalObjEx, which solves my problem.
Now I can do calls with arbitrary arguments and not being afraid of messing 
syntax with accidential '[' or '{' chars. There are some limitations though, 
but this works quite normal now.

Still, I want better implementation, which, as I hope, will be more efficient.

IOW, I want this: :)

> Actually I want quite generic thing - I have a number of C objects  of
> type "xxx*", and I want to pass a number of them via array, so we have
> type "xxx**"

What makes me curious - I can freely hold TclObj* in pmc - get it from NCI and 
then pass it to NCI further (and I can also extract fields also)
What I can not do - is to write this value into some structure field.

I suspect this is due to my misunderstanding of syntax or concept, so I will 
be very grateful for help on the matter. 

Best regards,
Vadim.


More information about the Parrot-users mailing list