Any advice on the best way to organize a cross platform library for VS2008 Any advice on the best way to organize a cross platform library for VS2008 unix unix

Any advice on the best way to organize a cross platform library for VS2008


The IDEs are frustrating as hell to use, but it is "expected" of you. :) I find that I just create a "win32/" directory, in which the VC++ project files and directories go, in whatever manner the IDE wants to put them. In the project, I add the files in src/, the same as Unix. At least the IDE will refer to them with relative paths, so it tends to work out.

As for the code itself, using #if HAVE_UNISTD_H around #include <unistd.h> etc, has been very helpful, and in the Windows compile, I tend do have one "win32.h" file that does the porting need.

It gets a little ugly in win32.h, with the preprocessor calls for "strcase* -> stri*" and win32 versions of opendir etc. But I prefer that myself, as I personally do not want the bulk of the code be littered with #ifdef WIN32. I only boot Windows to compile, not to dev.

I will say that I did the Win32 IDE work with the idea that people could compile my apps themselves. This has never happened, and they ask me to compile newer versions. Which is the opposite to Unix world.