51 lines
691 B
C++
Raw Normal View History

2015-11-17 17:22:37 +01:00
#include "hello.h"
2016-07-09 11:21:54 +02:00
#include <stdio.h>
2015-11-17 17:22:37 +01:00
#ifdef _MSC_VER
2018-08-09 18:06:22 +02:00
# include "windows.h"
2015-11-17 17:22:37 +01:00
#else
2018-08-09 18:06:22 +02:00
# define WINAPI
2015-11-17 17:22:37 +01:00
#endif
2016-07-09 11:21:54 +02:00
extern "C" {
2015-11-17 17:22:37 +01:00
// test __cdecl stuff
2016-07-09 11:21:54 +02:00
int WINAPI foo();
2015-11-17 17:22:37 +01:00
// test regular C
2016-07-09 11:21:54 +02:00
int bar();
2016-10-30 18:24:19 +01:00
int objlib();
2017-07-20 19:35:53 +02:00
void justnop();
2015-11-17 17:22:37 +01:00
}
// test c++ functions
// forward declare hello and world
void hello();
void world();
2016-10-30 18:24:19 +01:00
// test exports for executable target
extern "C" {
int own_auto_export_function(int i)
{
return i + 1;
}
}
2015-11-17 17:22:37 +01:00
int main()
{
// test static data (needs declspec to work)
Hello::Data = 120;
Hello h;
h.real();
hello();
printf(" ");
world();
printf("\n");
foo();
printf("\n");
bar();
2016-10-30 18:24:19 +01:00
objlib();
2015-11-17 17:22:37 +01:00
printf("\n");
2017-07-20 19:35:53 +02:00
#ifdef HAS_JUSTNOP
justnop();
#endif
2015-11-17 17:22:37 +01:00
return 0;
}