This post originated from an RSS feed registered with Ruby Buzz
by Daniel Berger.
Original Post: The transition to Win32API
Feed Title: Testing 1,2,3...
Feed URL: http://djberg96.livejournal.com/data/rss
Feed Description: A blog on Ruby and other stuff.
So far, so good. We've now got pure Ruby versions of win32-file-stat, win32-file, win32-sound, and win32-clipboard. The win32-process package is pretty much finished. I'm merely debating about how to handle the exit status from methods like Process.wait, since updating $? manually within Ruby is not really meant to be a valid operation. I make take Sam Tesla's suggestion (from a suggested win32-open3 patch) and add Process.exit_status and Process.last_status methods.
I'm glad I decided to use Win32API. It did require taking a step back and creating a separate package, windows-pr, so that I could keep the method and constant declarations separate and out of the main body of the code. Hopefully, the individual modules are useful to other people as well.
One of the other advantages of using Win32API over a C extension, I think, is that it creates a lower barrier to entry for folks who may want to contribute to the project, but who don't know C. True, you still have to have a clue about the Windows API function, but you only need to know what it does, not how to pass struct pointers, for example. Well, I'm hoping anyway.
In the process, I've gotten a lot better at understanding how to properly pack & unpack data structures, thanks in large part to Heesob.