wash

          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 on 2006-06-15 14:53 wash 閱讀(262) 評論(0)  編輯  收藏 所屬分類: ruby rails

          主站蜘蛛池模板: 涟水县| 内江市| 沙雅县| 平塘县| 镇原县| 奉节县| 海口市| 连江县| 炉霍县| 根河市| 金秀| 乌拉特后旗| 建瓯市| 伊通| 鸡东县| 怀化市| 西华县| 兴宁市| 资中县| 镇远县| 达孜县| 临沂市| 清丰县| 静安区| 盘山县| 日喀则市| 安多县| 黄山市| 西乡县| 吉安县| 九台市| 开平市| 云和县| 正宁县| 阿巴嘎旗| 安宁市| 竹北市| 南和县| 吉林省| 平远县| 古丈县|