wash

          2006年6月15日 #

          programming ruby 2nd--extending ruby 1

          1.Ruby Object? in c
          2.juke box extension
          3.memory allocation
          4.ruby type system
          5.create an exception
          6embed a ruby interpreter
          7.bridge to other language
          8.c api
          1.
          p269
          Sometimes, though, life is more complicated. Perhaps you want to define a global variable
          whose valuemust be calculated when it is accessed. You do this by defining hooked
          and virtual variables. A hooked variable is a real variable that is initialized by a named
          function when the corresponding Ruby variable is accessed. Virtual variables are similar
          but are never stored: their value purely comes from evaluating the hook function.
          See the API section that begins on page 294 for details.
          If you create a Ruby object from C and store it in a C global variable without exporting
          it to Ruby, you must at least tell the garbage collector about it, lest ye be reaped
          inadvertently.
          static VALUE obj;
          // ...
          obj = rb_ary_new();
          rb_global_variable(obj);

          posted @ 2006-06-15 14:53 wash 閱讀(261) | 評論 (0)編輯 收藏

          主站蜘蛛池模板: 嘉峪关市| 柳江县| 景宁| 府谷县| 沅陵县| 仪征市| 丁青县| 黎城县| 嘉兴市| 叙永县| 赤水市| 安岳县| 修文县| 务川| 肃南| 大关县| 防城港市| 炉霍县| 靖安县| 崇礼县| 健康| 普宁市| 江阴市| 霞浦县| 安平县| 大邑县| 运城市| 开远市| 同江市| 遵义市| 印江| 许昌市| 禄劝| 上栗县| 浠水县| 江孜县| 华坪县| 鲜城| 收藏| 南汇区| 扬中市|