views:

511

answers:

2

I'm working on a new solution configuration for our large VC++ project using VS 2008. I'd like this configuration to use the multicore build flag /MP.

However, the "#import" feature of generating COM wrapper classes is sprinkled through-out the code base and this feature is not supported when using /MP.

I understand why #import won't work, I want to know if anyone has faced this issue and how they worked around it?

I am doing the following:

  • Not use the /MP flag on projects that are small or beyond help. (maybe I'll come back to them later)
  • Removed the #import and replaced it with a more standard MIDL-generated header (#include). This is only an option in a few places that are easy to convert to old school COM.
  • Make a new project that #imports the remaining libraries. Make that build first. #Include the .tlh files it creates in all the places that #imported previously.

I'm curious if anyone has any other suggestions? Also, on the last point (making a new project and using #import only there) - if you did something like this, how did you do it? What type of project, what did the "source" look like, where did you output files? How did you include them? (you know, do all the thinking for me!)

+2  A: 

I have a project with two source files which #import the same file. When compiling with /MP, it would occasionally get an access denied error since both source files were trying to create the .tlb at the same time. I correct this by enabling pre-compiled headers, and adding the #import into the pre-compiled header source file.

This worked for me. Not sure if there are any downsides, but for now I'm happy. Thanks.
criddell
A: 

You can use the /MP option for the project as a whole, and then make an exception for a single file using the /MP1 option.

Dimitri C.
I would be nice but it doesn't work.
Sorin Sbarnea