From: Simon Strandgaard Date: 2003-11-20T00:17:17+09:00 Subject: Re: $& write-protected? On Wed, 19 Nov 2003 23:24:17 +0900, ts wrote: >>>>>> "S" == Simon Strandgaard writes: > S> Great, so it *is* possible.. I will look at it tomorrow (C++SWIG). > ^^^^ > no need of SWIG in this case :-) Maybe overkill. My first thought were to extern 'last_match_getter' from 're.c' and just supply my own last_match_setter. But then I noticed the function are are 'static' (private). How do you think I shall implement this ? server> gcc assign.c -I/usr/home/neoneye/install/ruby-1.8.1 /usr/lib/crt1.o: In function `_start': /usr/lib/crt1.o(.text+0x81): undefined reference to `main' /var/tmp//ccu9UXrr.o: In function `Init_Assign': /var/tmp//ccu9UXrr.o(.text+0x17): undefined reference to `last_match_getter' /var/tmp//ccu9UXrr.o(.text+0x21): undefined reference to `rb_define_virtual_variable' server> expand -t4 assign.c #include extern VALUE last_match_getter(); static void last_match_setter(VALUE val) { /* TODO */ } void Init_Assign() { rb_define_virtual_variable("$&", last_match_getter, last_match_setter); } server>