#import MFC

Whoever designed the #imports functionality in VS2008 and the way it interacts with MFC owes me a weekend.

I have been migrating a big VS project to VS2008 and have had some real fun managing all the includes and imports.

When I did the codematic base xll project I was very careful to structure things so as to avoid header hell. The original developer of this project took another route.

I was blocked by a stray windows.h include. So I listed them – all 25,000 includes! there were 20 windows.h ones. And the stray one was early meaning a later MFC check failed. In the end I managed to shuffle all the different parts around to get it to compile. But what a PITA. And its always depressing when you go from one compile error to 941!

The stray one (in OLEDB) was about 9 include levels down so trying a few COM_NO_WINDOWSH type guards actually made things worse. Finally it turned out that I needed to move one of the #imports into stdafx.h and leave the other 2 in their original .h.

So the original problem was that function names were not appearing in Excel 2007, that was an easy fix, involving upgrading the XLL+ version to one that supports 2007. The hard work was in the C++ include dance to get the thing to compile. The actual project is very interesting, messing with the arcane header include rules in C++ less so.

Lucky there isn’t much snow, or I’d be really bitter at missing some decent snowboarding.

What did you get up to this weekend?

Cheers

Simon.

Advertisements

One Response to “#import MFC”

  1. Charles Says:

    This weekend I took a break from XLL+ (still working out how to build a thread-safe Container based on STL Map) and had a Pinot Noir tasting evening (1x US, 1x FR, 1x AU and 4x NZ) with some Pinot-Noir-fellow-fanatics friends.
    The winner was NZ3 (Villa Maria special selection).

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: