VCBuildHook updated for VS 2005 SP1

I’ve installed Visual Studio 2005 SP1 and have been busy testing all my projects to make sure they didn’t break. Microsoft did fix at least one of the bugs I reported (the resource editor choked on resource strings that contained an embedded NULL character), but the IDE still crashes fairly consistently if I initiate a large solution build while the Intellisense database is being rebuilt. SP1 also managed to break my VCBuildHook utility, so I’ve uploaded an updated version (2.0.3.0) for use with SP1.

Visual Studio 2005 Service Pack 1 is here!

Finally, the long awaited service pack 1 for Visual Studio 2005 is released! The service pack has been in the pipeline since soon after Visual Studio 2005 shipped last November, with release dates slipping month after month. The latest official release date was announced as “early 2007”. Perhaps this was an intentional attempt to alleviate some of the waiting pains with a suprise release (or maybe just the Microsoft rumor mill on autopilot).

Be prepared for a long install. The download page warns that it could take an hour or more to verify digital signatures before the service pack installation even begins.

Visual Studio Version Hunt

If you’ve been programming with ObjectARX for a while, you already know that each version of the ObjectARX SDK only works with a specific version of Visual Studio. Mazhar Basa touches on the subject in his article Components of ObjectARX Applications. My VCBuildHook utility makes it possible to build for multiple target AutoCAD versions from a single Visual Studio 2005 solution, but this utility still needs the older versions of Visual Studio to be installed on the same system in order to perform its magic.

The problem is, legitimate licenses of older versions of Visual Studio are hard to come by. Back in the Visual Studio .NET 2003 days, you could purchase a new license of VS 2003, then get a free license downgrade from Microsoft that allowed you to install Visual Studio 2002 side by side on the same system. That combination allowed you to target AutoCAD versions as far back as AutoCAD 2004. Unfortunately, Microsoft stopped offering the VS 2002 downgrade license when Visual Studio 2005 began shipping in November of 2006.

The end result is that new ObjectARX programmers are faced with a dilemma if they need to target anything older than AutoCAD 2007. One of the attendees at my “High-Octane ObjectARX” class at AU 2006 reminded me that MSDN (Microsoft Developer Network) members can download older versions of Visual Studio from the MSDN subscriber download center.

I have verified that Visual Studio .NET 2002 (VS 2002) is available for download to MSDN Professional subscribers, but I could not find Visual Studio 6.0, which is required to target AutoCAD 2000 – 2002. Visual Studio 4.2 (required for AutoCAD R14) is available though, so maybe I’m just not looking in the right place.

If you are a professional software developer, whether commercial or in-house, you should consider subscribing to MSDN for various reasons. If you’re an ObjectARX programmer and need to target older versions of AutoCAD, MSDN may be the only way to obtain the older Visual Studio build tools and libraries that you’ll need.

Demand Loading a VLX File

Some years ago I wrote a small ObjectARX module named VLXLoad that loads a .vlx file of the same name and in the same directory as the .arx module. I never claimed credit for the utility, but now that I’ve released the source code, I guess I’ll have to own up to it.

If you’re interested in seeing an example of “dynamically” defining an ADS (lisp callable) function when an ObjectARX module loads, take a look at the VLXLoad source code. The code also demonstrates how to call the GetModuleFileName() WinAPI function to get the path of the executing module, and how to declare and use the undocumented ads_queueexpr() function.

There is no documentation (and probably no comments), so be warned. The download contains ready to build projects for Visual Studio 2002 (targeting AutoCAD 2004-2006) and Visual Studio 2005 (targeting AutoCAD 2007). These projects were both created with the corresponding ObjectARX wizard, and are included in the course materials for my “High-Octane ObjectARX” class at AU 2006 as an example of a simple (yet very useful) ObjectARX application.

If you just want to use VLXLoad, I’ve also made the original pre-built binaries available on my Freebies page. The idea is to rename the correct .arx file so it matches the name of your .vlx, then set up registry demand loading so that the .arx loads when AutoCAD starts. The .arx then loads the associated .vlx file, and voila, demand loading for .vlx files. Instructions for setting up demand loading have been posted on the ‘net in the past (and it is well documented in the ObjectARX SDK), so I won’t describe that here.

Have you made your mistake today?

It may seem strange to some of you, but I consider myself an artist. Visual Studio is my canvas, and the keyboard is my paintbrush. This is why I wouldn’t survive in a stuffy corporate environment with committees, red tape, and politics. I’m a visionary, not a software engineer. I don’t like to plan every little detail; I’d rather start with a grand vision and just let the code go wherever my vision leads it.

I confess this can be both a strength and a weakness. For example, I’ll spend two weeks refactoring perfectly working code because I don’t think it’s elegant enough. On the other hand, aesthetic beauty of structure and architecture is every bit as important in software as it is in other fields. It’s just that the benefits are intangible and more difficult to quantify.

Perfectly working code, you say? I admit, that’s a bit of a rarity these days. It’s a rarity precisely because not many programmers consider programming as an art form. Real artists are never satisfied with their work; they never stop working toward absolute perfection of both form and function.

This leads me to my real point. I have a favorite saying, “Have you made your mistake today?” Ironically, perfection can only be achieved by making mistakes. If you’re not making mistakes, you’re not learning. If you’re not learning, you’re not taking any risks. If you’re not taking any risks, you’re achieving mediocrity at best. Learn to make mistakes gracefully. Enjoy your capacity to learn and evolve toward perfection, no matter what kind of art you create.