Closed chriskrycho closed 9 years ago
Thanks. The most common solution to this problem though is just to define the macro to nothing and not bother using windows.i. Would you mind adding a simple example like that to this patch and then I'll apply it?
Sure! Something like this?
Alternately, you can simply undefine the macro and leave out
windows.i
entirely. Assuming you have defined the preprocessor asBAR_API
, you could do something like:%module bar #define BAR_API %include "bar.h"
Assuming that's to your liking, I'll probably get to it on Tuesday or so.
Yes, but to be absolutely clear for the reader, also show BAR_API being used in the function, so add in one line of bar.h, something like:
// bar.h
BAR_API void bar_function(int, double);
Very good. I'll add that and expand the example to include bar.h
properly as well, like:
%{
#include "bar.h"
%}
Note that you're actually patching generated files here - the master copies are in the swig repo.
Thanks, I've committed this now, see https://github.com/swig/swig/commit/aebc9379ed6dde9c8b903845decb3f017ebb873a and https://github.com/swig/swig/commit/7178bb11d3f089da7b241f49af6eba603a0e636d
Add a short paragraph and example of how to handle the way Microsoft recommends to wrap
__declspec
definitions in preprocessor macros and supply them in a common header file.