PageRenderTime 18ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/trunk/Examples/test-suite/extern_declaration.i

#
Swig | 31 lines | 21 code | 6 blank | 4 comment | 0 complexity | 059c26185ce7976ee535f9e034f880d5 MD5 | raw file
 1%module extern_declaration 
 2
 3// Test different calling conventions on Windows. Old versions of SWIG generated
 4// an incorrect extern declaration that wouldn't compile with Windows compilers.
 5#define SWIGEXPORT
 6#define SWIGSTDCALL
 7#define MYDLLIMPORT
 8
 9%{
10#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
11#  define MYDLLIMPORT __declspec(dllimport)
12#else
13#  define MYDLLIMPORT
14#endif
15%}
16
17MYDLLIMPORT extern int externimport(int i);
18SWIGEXPORT extern int externexport(int);
19extern int SWIGSTDCALL externstdcall(int);
20
21%{
22/*
23  externimport ought to be using MYDLLIMPORT and compiled into another dll, but that is 
24  a bit tricky to do in the test framework
25*/
26SWIGEXPORT extern int externimport(int i) { return i; }
27SWIGEXPORT extern int externexport(int i) { return i; }
28extern int SWIGSTDCALL externstdcall(int i) { return i; }
29%}
30
31