pass a non-standard object from C toTcl

Bradley Giesbrecht pixilla at macports.org
Mon Aug 21 16:57:48 UTC 2017


> On Aug 19, 2017, at 7:48 AM, Umesh Singla <umeshksingla at macports.org> wrote:
> 
> Hi
> 
> How do I pass "reg_snapshot->ports" below C struct back to Tcl in macports-base?
> 
> typedef struct {
>     char* variant_name;
>     char* variant_sign;
> } variant;
> 
> typedef struct {
>     char* name;
>     int requested;
>     char* state;
>     variant* variants;
> } port;
> 
> typedef struct {
>     sqlite_int64 id; /* rowid in database */
>     char* note;
>     port* ports;
>     reg_registry* reg; /* associated registry */
>     char* proc; /* name of Tcl proc, if using Tcl */
> } reg_snapshot;
> 
> I fetch the `ports` from a given reg_snapshot->id from SQLite, how can I pass the resulting ports back to Tcl procedure? Do I need to have `proc` in them too?

I don’t know, hopefully someone else can provide a better answer soon.

Have you looked how other port functionality accomplishes something similar?


Regards,
Bradley Giesbrecht (pixilla)



More information about the macports-dev mailing list