say.cxx 687 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. int objlib();
  14. void justnop();
  15. }
  16. // test c++ functions
  17. // forward declare hello and world
  18. void hello();
  19. void world();
  20. // test exports for executable target
  21. extern "C" {
  22. int own_auto_export_function(int i)
  23. {
  24. return i + 1;
  25. }
  26. }
  27. int main()
  28. {
  29. // test static data (needs declspec to work)
  30. Hello::Data = 120;
  31. Hello h;
  32. h.real();
  33. hello();
  34. printf(" ");
  35. world();
  36. printf("\n");
  37. foo();
  38. printf("\n");
  39. bar();
  40. objlib();
  41. printf("\n");
  42. #ifdef HAS_JUSTNOP
  43. justnop();
  44. #endif
  45. return 0;
  46. }