0

Tcl_LinkVar can link C variable to Tcl variable directly. When variable in C changes, the Tcl variable changes accordingly. It is very convenient.

Example:

Tcl_LinkVar(interp, "player_x", (char *) &player.world_x, TCL_LINK_DOUBLE);

I am wondering if Guile supports similar function? Or when the variable change, I must pass value to variable in scheme every time.

kostix
  • 51,517
  • 14
  • 93
  • 176
louxiu
  • 2,830
  • 3
  • 28
  • 42

1 Answers1

0

Couldn't you get the c variable's pointer via the ffi?, similar how you do with functions.

Maybe the ffi doesnt support that, but I know you can access variable pointers by name using something like libtool's dlsym function (which is used to get function pointers as well). I'd assume guile's ffi is using something similar underneath.

joesmoe891
  • 223
  • 3
  • 10