PageRenderTime 40ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

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

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