summaryrefslogtreecommitdiff
path: root/tests/asm-c-connect-1.c
blob: 8a28d781fa0897e08e822c1d9fb450e8cc526168 (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
#include <stdio.h>

#if defined _WIN32 && !defined __TINYC__
# define _ "_"
#else
# define _
#endif

static int x1_c(void)
{
    printf(" x1");
    return 1;
}

asm(".text;"_"x1: call "_"x1_c; ret");

void callx4(void);
void callx5_again(void);

void x6()
{
    printf(" x6-1");
}

int main(int argc, char *argv[])
{
    printf("*");
    asm("call "_"x1");
    asm("call "_"x2");
    asm("call "_"x3");
    callx4();
    asm("call "_"x5");
    callx5_again();
    x6();
    printf(" *\n");
    return 0;
}

static
int x2(void)
{
    printf(" x2");
    return 2;
}

extern int x3(void);

void x4(void)
{
    printf(" x4");
}

void x5(void);
void x5(void)
{
    printf(" x5");
}