On combining #import and /MP in C++ builds with VS2010

I’m currently busy porting a large native C++ project from VS2008 to VS2010 and one of the issues I keep running into was build times. The VS2008 build uses a distributed build system; Unfortunately the vendor doesn’t support VS2010 yet, so I couldn’t use the same infrastructure. In order to get a decent build speed, I started exploring MSBuild’s ability to build projects in parallel (which is fairly similar to VS2008′s ability to build projects in parallel) and the C++ compiler’s ability to make use of multiple processors/cores, aka the /MP switch.

This resulted in a decent speedup in a lot of projects but then I ran into an issue with a few projects in the solution using #import to generate import libraries and smart pointer wrappers for COM components. Unfortunately it turns out that the compiler doesn’t support multiprocessor compiles when the file to be compiled is using #import – which I admittedly didn’t find that surprising, given that the compiler is actually generating a couple of source files when processing #import.

However there is a workaround if your project is using precompiled headers – include the #import statement in the precompiled header. If you’re using no_implementation in the header #import, move the implementation_only #import into the cpp file that triggers the generation of the precompiled header, then remove the #import directives from the other files source files in the project. Just by observing the way projects are built, it seems that the precompiled header is always generated before the rest of the project is built. Of course this makes sense, there is not much of a point of kicking off the compile of other files in the project that need the precompiled header until it has been built. This however means that the compiler deems it safe to use #import inside a precompiled header.

This appears to work around the compiler’s limitation and allows you to use /MP in builds that use #import.

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon
Posted in C++ | Tagged , , | Leave a comment

That would explain a few things…

Now that’s awfully close to the mark for those of us who’ve work on trading systems:

Geek And Poke: High-Frequency Trading

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon
Posted in Fun stuff | Leave a comment

Using CEDET-1.0 pre7 with Emacs 23.2

It’s been mentioned in several places that GNU Emacs versions sometime after 23.1.50 do come with an integrated version of CEDET. While I think that’s a superb idea it unfortunately managed to break my setup, which relies on a common set of emacs-lisp files that I hold under version control and distribute across the machines I work on. Those machines have different versions of GNU-based Emacsen (pure GNU, Emacs/W32, Carbon Emacs etc) so I can’t rely on the default CEDET. Unfortunately when I got a new machine and put a GNU Emacs 23.2 on there, my carefully crafted (OK, I’m exaggerating) .emacs wouldn’t play ball because the built-in CEDET conflicted with the pre7 that I had already installed on that machine.

I didn’t want to have to make extensive modifications to my .emacs, but a little time spent on Google brought up a post by Marco Bardelli on the CEDET-devel mailing list with a little code snippet that removes the built-in CEDET from the load-path. After putting this into my .emacs, my -pre7 config is working again.

For those in a similar quandary, here is the snippet in all its glory:

(setq load-path
      (remove (concat "/usr/share/emacs/"
		      (substring emacs-version 0 -2) "/lisp/cedet")
	      load-path))
SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon
Posted in Emacs | 2 Comments

Looks like another book for the reading list…

As I enjoy Rands’ writing, I think his new book Rands In Repose: Being Geek just made it onto my reading list. As soon as I get through the other three books I still have in my ‘must read urgently’ stack…

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon
Posted in General Programming | Leave a comment

Looks like CEDET 1.0 pre7 has been out for a while

Yeah, yeah, I’m somewhat behind the curve again. Anyway, for those who, like me, do like the power of CEDET in their Emacsen, it appears that -pre7 has now been available for a little while.

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon
Posted in Emacs | 1 Comment

Welcome back to the new blog, almost the same as the old blog

The move to the other side of the Atlantic from the UK is almost complete, I’m just waiting for my household items – and more importantly, my computer books etc – to turn up. So it’s time to start blogging again in the next few weeks. Due to some server trouble in the UK, combined with the fact that I do like Serendipity as a blogging system but was never 100% happy with it, I’ve switched to using WordPress on a server here in the US. The old blog will stay up, at least as long as the server stays put, but I won’t add any new content to the old blog.

Enough meta-blogging though, I should be back to the usual 1-2 post per month soon, so if you kindly could subscribe to the RSS feed and you’ll see when all of this is up and running again.

SociBook del.icio.us Digg Facebook Google Yahoo Buzz StumbleUpon
Posted in Uncategorized | Leave a comment