This post originated from an RSS feed registered with Ruby Buzz
by .
Original Post: Ruby, libxml and Windows
Feed Title: cfis
Feed URL: http://cfis.savagexi.com/articles.rss
Feed Description: Charlie's Blog
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by
Latest Posts From cfis
Advertisement
Let's say my last post tempted you to check out libxml's validation functionality. However, you work in shop that develops on multiple platforms, including Windows, OS X and Linux, so you code has to run on all three platforms.
You happily note that libxml does run on all three platforms, so you download and install it. Next, you fire up your friendly command prompt and ask Ruby Gems to install the appropriate bindings.
Unfortunately, you discover there isn't a pre-built binary for Windows. Being in a hurry, you open up VC++ (experience has taught you that MinGW is a royal pain and will undoubtedly eat up the rest of your day).
Sadly, VC++ doesn't compile the extension. At least with this code, its more pedantic than GCC and flags some sketchy code that increments void pointers. You also note that you have to export the main extension function from the DLL (what developer at Microsoft years ago thought this was a good idea?).
So, to save you the trouble, I've provided a binary that works with Ruby 1.8.5. If you'd like to see the patch, its available at RubyForge.
Yup, the "_so" bit is required due to the way the extension is packaged (it shouldn't be, and I was tempted to remove it, but thought it was better to maintain cross-platform compatibility).