>>>>> "R" == Rob Partington <rjp / browser.org> writes:

R> Removing the "require" and "Extension.new" lines makes everything fine.

R> Has anyone seen this kind of weirdness before?

 Yes, you have a bug in your extension

 If you want an example for mmap(), look in RAA the extension Mmap

pigeon% cat b.rb
#!/usr/bin/ruby
require 'mmap'
a = Mmap.new("b.rb", "a")
a.gsub!(/./, '(\&)')
pigeon% 

pigeon% b.rb
pigeon%
 
pigeon% cat b.rb
(#)(!)(/)(u)(s)(r)(/)(b)(i)(n)(/)(r)(u)(b)(y)
(r)(e)(q)(u)(i)(r)(e)( )(')(m)(m)(a)(p)(')
(a)( )(=)( )(M)(m)(a)(p)(.)(n)(e)(w)(()(")(b)(.)(r)(b)(")(,)( )(")(a)(")())
(a)(.)(g)(s)(u)(b)(!)(()(/)(.)(/)(,)( )(')(()(\)(&)())(')())
pigeon% 


Guy Decoux