61 lines
893 B
C++
Raw Normal View History

2016-07-09 11:21:54 +02:00
#include <stdio.h>
2020-02-01 23:06:01 +01:00
#include "hello.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
2020-08-30 11:54:41 +02:00
// forward declare hello, world, cliFunction and nonCliFunction
2015-11-17 17:22:37 +01:00
void hello();
void world();
2020-08-30 11:54:41 +02:00
void cliFunction();
void nonCliFunction();
2015-11-17 17:22:37 +01:00
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");
2020-08-30 11:54:41 +02:00
cliFunction();
printf("\n");
nonCliFunction();
printf("\n");
2017-07-20 19:35:53 +02:00
#ifdef HAS_JUSTNOP
justnop();
2023-07-02 19:51:09 +02:00
#endif
#ifdef HELLO_VFTABLE
HelloVFTable helloVFTable(1);
2017-07-20 19:35:53 +02:00
#endif
2015-11-17 17:22:37 +01:00
return 0;
}