Ye Olde
Talbott Blog

So Much for Swig

Well, after further investigation, I have determined that Swig is not appropriate for accessing SWT from Ruby due to the pollution of the SWT C code with JNI trash. Basically, there doesn’t appear to be a machine-automation path to creating ‘RWT.’ Thus, I’m now going down the path of adapting the code by hand. This is going OK, but there are some issues involved.

What are the issues? Well, first of all, I’m worried about keeping up with SWT. Because the conversion is not direct, it’s a lot more difficult to make sure that when a new version of SWT is released, all of the cool new stuff is supported. Holes can occur without my even knowing it.

Another thing I’m worried about, which I’ve always been a bit wary of, is the license terms on SWT. It’s a bit hard to figure out what they are, and when I did find what I think they were, it was hard to determine what I was allowed to do with the library. Hopefully a hand-translated reimplementation will not be affected; I’m not going to worry about it until the project actually nears usefulness, though. If necessary, a clean room version could be done after the viability of the approach has been established.

The final issue is just my learning curve; hand-translating lays a bit more of a burden on me to figure out how to code C again. Actually, though, I’m really enjoying this part, as it’s fun to fiddle around with the lower levels, especially when it enhances my Ruby experience to boot.

BTW, Swig seems like a very useful tool for wrapping other libraries of code; it just doesn’t work very well for a JNI-centric library.