[Win32utils-devel] win32-mmap - trying to marshal self

Berger, Daniel Daniel.Berger at qwest.com
Fri Oct 13 15:00:09 EDT 2006

Hi all,

I realized the current implmentation has a problem - you can only get the last value set?  I realized, after looking at the old C code, that it actually stores values in a hash and marshals the hash, not the values themselves.

That seemed clunky to me, though.  I thought it would be more interesting if we just marshalled the entire mmap object and passed that back and forth.  Unfortunately, it doesn't seem to work.

For the getter in method_missing I simply did:

   marshal = Marshal.dump(self)

For the getter in method_missing I did:

   obj = memcpy(buf, @address, @size)
   val = object.send(obj.to_sym)
   instance_variable_set("@#{method}", Marshal.load(val))

But when I run the map1.rb and map2.rb scripts again, I get errors (and beeping!) with odd characters no less:

C:/Documents and Settings/djberge/workspace/win32-mmap/lib/win32/mmap.rb:334:in `send': undefined method o:►Win32::MMap¶
@inheriti' for nil:NilClass (NoMethodError)
        from C:/Documents and Settings/djberge/workspace/win32-mmap/lib/win32/mmap.rb:334:in `method_missing'
        from map2.rb:8

Is this because of the Semaphore?  If we can't marshal self, that's fine, I'll just resort to the hash strategy, but I thought I would ask.



This communication is the property of Qwest and may contain confidential or
privileged information. Unauthorized use of this communication is strictly 
prohibited and may be unlawful.  If you have received this communication 
in error, please immediately notify the sender by reply e-mail and destroy 
all copies of the communication and any attachments.

More information about the win32utils-devel mailing list