Move the output format macros into the macros.pl mechanism
[nasm.git] / test / objlink.c
blobb767b012e398eda238187dc0ddd923721b6abbb3
1 /*
2 * test source file for assembling to Microsoft 16-bit .OBJ
3 * build with (16-bit Microsoft C):
4 * nasm -f obj objtest.asm
5 * cl /AL objtest.obj objlink.c
6 * other compilers should work too, provided they handle large
7 * model in the same way as MS C
8 */
10 #include <stdio.h>
11 #include <inttypes.h>
13 int8_t text[] = "hello, world\n";
15 extern void function(int8_t *);
16 extern int bsssym, commvar;
17 extern void *selfptr;
18 extern void *selfptr2;
20 int main(void)
22 printf("these should be identical: %p, %p\n",
23 (int32_t)selfptr, (int32_t)&selfptr);
24 printf("these should be equivalent but different: %p, %p\n",
25 (int32_t)selfptr2, (int32_t)&selfptr2);
26 printf("you should see \"hello, world\" twice:\n");
27 bsssym = 0xF00D;
28 commvar = 0xD00F;
29 function(text);
30 printf("this should be 0xF00E: 0x%X\n", bsssym);
31 printf("this should be 0xD00E: 0x%X\n", commvar);
32 return 0;