Recompile Poco For #import

Hello oF community.

I’m presently trying to use a 3rd party .dll using a #import command. To get this to work I need to take several steps.

The first one is to Disable the /MP compile flag as Multi-processor compiling doesn’t support #import statements (which makes total sense). I believe a better way to do this would be to make a precompiled header file and then compile that first with the #import in it but I’ll get to that later!

Once I do that I get problems with my comdef.h file which has some endefined macros in it. Specifically: FormatMessage. This was trange because this is a generated file but I tracked the issue down to poco. Poco has a file called unwindows.h which undefines a bunch of windows #defines including FormatMessage! In fact there is a very helpful comment within the unwindows.h file that even explains how to deal with this issue:

// To disable the #undef's, compile POCO with the POCO_NO_UNWINDOWS macro #define'd.

Amazing! What I don’t know how to do is easily recompile poco once I’ve set this flag. And furthermore I’m not exactly sure where the most responsible place to #define that flag is. I can obviously #define it right at the top of the unwindows.h file but I think it would be better put elsewhere (ie in Poco.h or something like that).

So what I’m looking for is the best way to recompile Poco!


I’ve just realized that in 0.10.1 Poco dependency as been removed! I can now compile with the #import statement byt updating my project to 0.10.1 and using VS 2017.