From aebc9379ed6dde9c8b903845decb3f017ebb873a Mon Sep 17 00:00:00 2001 From: Chris Krycho Date: Tue, 10 Mar 2015 16:45:36 -0400 Subject: [PATCH] Document %include behavior for __declspec preprocessor directives. 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. --- Doc/Manual/Windows.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Doc/Manual/Windows.html b/Doc/Manual/Windows.html index 0685242ba..b1bc42bc6 100644 --- a/Doc/Manual/Windows.html +++ b/Doc/Manual/Windows.html @@ -293,9 +293,9 @@ Execute the steps in the order shown and don't use spaces in path names. In fact Start the MSYS command prompt and execute:
 cd /
-tar -jxf msys-automake-1.8.2.tar.bz2 
+tar -jxf msys-automake-1.8.2.tar.bz2
 tar -jxf msys-autoconf-2.59.tar.bz2
-tar -zxf bison-2.0-MSYS.tar.gz   
+tar -zxf bison-2.0-MSYS.tar.gz
 
@@ -387,6 +387,22 @@ Include it like you would any other interface file, for example: __declspec(dllexport) ULONG __stdcall foo(DWORD, __int32); +

Note that if you follow Microsoft's recommendation of wrapping the +__declspec calls in a preprocessor definition, you will need to +make sure that the definition is included by SWIG as well, whether you define it +manually or it is included in a header. For example, if you have specified the +preprocessor definition in a header named export_lib.h and include +other headers which depend on it, you should use the %include directive +to include the definition explicitly. For example, if you had a header file, +bar.h, which depended on export_lib.h, your SWIG definition +file might look like:

+ +
+%module bar
+%include <windows.i>
+%include "export_lib.h"
+%include "bar.h"
+