views:

87

answers:

1

Hello,

In a large C++ solution, is there a best/standard way to separate the include files necessary to build an intermediary DLL and the include files which will be used by the DLL clients ?

We have grouped all the include files in a folder called Interface (for DLL interface), but there the customers have to either include the Interface folder as a default include folder or type the full name as:

#include "ProjectName/Interface/myinterface.h"

Wouldn't it be better to create a separate folder called exports where I would create a folder called ProjectName and put the include files there ? So that the customers would be typing:

#include "ProjectName/myinterface.h"

If I do the thing right above, then should I keep the files within the solution and produce a post build event (I use Visual Studio 2k5) to copy the files into the "export" folder (/ProjectName/) ? Or is it better to just include directly the files from this folder within my project (this is more direct and has less chances to cause maintenance issues ?

I am more looking for advice than for a definite solution.

Thank you for reading this !

Anthony

+2  A: 

If an interface could consist of more than one header,

#include "ProjectName/Interface/header1.h"

seems better to me.

sbi
I kind of like this as well, but when you share the same development tree, some people might try to do something like:#include "ProjectName/notpartoftheinterface.h"and you then have to chase them for removing these includes.
BlueTrin
@BlueTrin: Why not keep public interface files in a separate directory to the private header files?
jon hanson
@BlueTrin: What I've seen done in one project was that all implementation details (cpp files and private headers) where in an `_Imp` folder within the `Interface` folder. You could grep the sources and everything outside of `blah` shouldn't include `"blah/imp"..."`. You could also take the source tree, delete all `_Imp` folders, and you have all the headers to hand out with all the private stuff deleted. I liked that.
sbi