blob: eb9c0ff8f0885841e119025e5b1ddf082064a125 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#include "hello.h"
#include <stdio.h>
#ifdef _MSC_VER
#include "windows.h"
#else
#define WINAPI
#endif
extern "C" {
// test __cdecl stuff
int WINAPI foo();
// test regular C
int bar();
int objlib();
void justnop();
// test const export
#ifdef _WIN32
// data symbols must be explicitly imported
__declspec(dllimport) extern const char testconst[];
#else
extern const char testconst[];
#endif
}
// test c++ functions
// forward declare hello and world
void hello();
void world();
// test exports for executable target
extern "C" {
int own_auto_export_function(int i)
{
return i + 1;
}
}
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();
objlib();
printf("\n");
printf("%s", testconst);
printf("\n");
#ifdef HAS_JUSTNOP
justnop();
#endif
return 0;
}
|