[Win32utils-devel] Need some help with latest win32-mmap

Heesob Park phasis at gmail.com
Mon Oct 9 22:02:21 EDT 2006


Hi,

2006/10/10, Daniel Berger <Daniel.Berger at qwest.com>:

> Heesob Park wrote:
> > Hi,
> >
> > 2006/10/7, Daniel Berger <djberg96 at gmail.com <mailto:djberg96 at gmail.com
> >>:
> >
> >     Hi all,
> >
> >     I've got the latest win32-mmap code checked into
> CVS.  Unfortunately, it
> >     seems that I'm not able to open an existing mapping and retrieve set
> >     data.  Below is a simple example that seems like it ought to work
> but
> >     doesn't.  Any ideas?
> >
> >     # map1.rb
> >     require 'win32/mmap'
> >     include Win32
> >
> >     mmap = MMap.new(:name => 'alpha', :size => 20)
> >     p mmap.address
> >
> >     mmap.test = "hello"
> >
> >     mmap.close
> >
> >     # map2.rb
> >     # mmap = MMap.open('alpha') # Boom!
> >
> >     mmap = MMap.new(:name => 'alpha', :size => 20) # Ok so far...
> >     p mmap.test # Boom!
> >
> >     mmap.close
> >
> >     I tried using MMap.open and MMap.new.  Neither seems to work as
> >     expected.  What am I doing wrong?
> >
> >
> > That's strange.
> > I downloaded and tested the win32-mmap and your map1.rb and map2.rb
> > It runs ok and seems to work as expected.
> >
> > Regards,
> >
> > Park Heesob
>
> Really?  When you run map2.rb you see "hello"?
>
> When I run map2.rb I get the same address.  But when I run map2.rb I get
> an
> error at mmap.rb, line 270: 'load - marshal data too short'.  It seems
> that I'm
> getting an empty buffer from the memcpy, but I don't understand why.
>
> I just tried this at work, too - same result.


As a matter of fact I modified map1.rb like this:

require 'win32/mmap'
include Win32

mmap = MMap.new(:name => 'alpha', :size => 20)
p mmap.address

mmap.test = "hello"
sleep 1000
mmap.close

And run map1.rb in one console and run map2.rb in another console.
When running map2.rb only, I also get "marshal data too short" error.
Regards,

Park Heesob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/win32utils-devel/attachments/20061010/a0585682/attachment.html 


More information about the win32utils-devel mailing list