Code ConsolidationPosted: February 16, 2013
I have these two projects:
LJIT2Win32 – Provides LuaJIT FFI access to various of Microsoft’s most useful APIs
LJIT2WinCNG – Provides LuajJIT FFI access to Microsoft’s latest crypto APIs
Windows is a large sprawling API set which represents the very history of the last 30 years of personal computing. As such, you find many different styles, many different approaches, redundancies, inefficiencies, etc.
I want to program on Windows, and I want to do it in such a way that is fairly consistent, predicatable, robust, and reliable. These libraries take a layered approach to providing exactly this. I had originally started with another project, BanateCoreWin32, in which I had dumped a whole bunch of experimental stuff, then I took a more systematic approach to create LJIT2Win32. When I started into the Crypto stuff, I thought it warranted its own project, so I developed the LJIT2WinCNG project. I haven’t made much changes to this last one, so I thought it was good enough to join the mainstream. So, any future changes, can all be consolidated in one place.
I have some more Windows specific code related to crypto and networking that I will eventually merge into this codebase as well.
Microsoft itself has provided various frameworks to core Win32 functions over the years. Everything from MFC, ATL, to .net and Silverlight. With each iteration and library comes a whole new ecosystem and environment. What I’ve done in my approach is not to really introduce too much overhead or new concepts. At the lowest level, it’s just FFI interfaces to core .dll functions. You could program at this level and be very happy. Your C/C++ code would port almost seamlessly. I do provide wrappers and higher level functions where it makes sense.
I’ve written about API pain previously, and I try to apply the lessons learned as much as possible. I will say that once you get a more uniform API to work against, it’s amazing how powerful Windows really is. I’d say Linux gives you a lot more control of some rather lower level stuff. Windows has been around long enough that device drivers and other software libraries often times are available only on Windows, and slowly show up in other environments. Having easy, garbage collected interfaces to this stuff really makes programming in Windows fairly straight forward.
At any rate, some consolidation has occured, now I can continue to evolve a single codebase.