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.
This commit is contained in:
parent
55e7264d43
commit
aebc9379ed
1 changed files with 18 additions and 2 deletions
|
|
@ -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:
|
Start the MSYS command prompt and execute:
|
||||||
<div class="shell"><pre>
|
<div class="shell"><pre>
|
||||||
cd /
|
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 -jxf msys-autoconf-2.59.tar.bz2
|
||||||
tar -zxf bison-2.0-MSYS.tar.gz
|
tar -zxf bison-2.0-MSYS.tar.gz
|
||||||
</pre></div>
|
</pre></div>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|
@ -387,6 +387,22 @@ Include it like you would any other interface file, for example:
|
||||||
|
|
||||||
__declspec(dllexport) ULONG __stdcall foo(DWORD, __int32);
|
__declspec(dllexport) ULONG __stdcall foo(DWORD, __int32);
|
||||||
</pre></div>
|
</pre></div>
|
||||||
|
<p>Note that if you follow Microsoft's recommendation of wrapping the
|
||||||
|
<tt>__declspec</tt> 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 <tt>export_lib.h</tt> and include
|
||||||
|
other headers which depend on it, you should use the <tt>%include</tt> directive
|
||||||
|
to include the definition explicitly. For example, if you had a header file,
|
||||||
|
<tt>bar.h</tt>, which depended on <tt>export_lib.h</tt>, your SWIG definition
|
||||||
|
file might look like:</p>
|
||||||
|
|
||||||
|
<div class="code"><pre>
|
||||||
|
%module bar
|
||||||
|
%include <windows.i>
|
||||||
|
%include "export_lib.h"
|
||||||
|
%include "bar.h"
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue