say.cxx 606 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "hello.h"
  2. #include <stdio.h>
  3. #ifdef _MSC_VER
  4. #include "windows.h"
  5. #else
  6. #define WINAPI
  7. #endif
  8. extern "C" {
  9. // test __cdecl stuff
  10. int WINAPI foo();
  11. // test regular C
  12. int bar();
  13. }
  14. // test c++ functions
  15. // forward declare hello and world
  16. void hello();
  17. void world();
  18. // test exports for executable target
  19. extern "C" {
  20. int own_auto_export_function(int i)
  21. {
  22. return i + 1;
  23. }
  24. }
  25. int main()
  26. {
  27. // test static data (needs declspec to work)
  28. Hello::Data = 120;
  29. Hello h;
  30. h.real();
  31. hello();
  32. printf(" ");
  33. world();
  34. printf("\n");
  35. foo();
  36. printf("\n");
  37. bar();
  38. printf("\n");
  39. return 0;
  40. }