home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / nasm097.zip / TEST / OBJLINK.C < prev    next >
C/C++ Source or Header  |  1997-10-01  |  919b  |  32 lines

  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.  */
  9.  
  10. #include <stdio.h>
  11.  
  12. char text[] = "hello, world\n";
  13.  
  14. extern void function(char *);
  15. extern int bsssym, commvar;
  16. extern void *selfptr;
  17. extern void *selfptr2;
  18.  
  19. int main(void) {
  20.     printf("these should be identical: %p, %p\n",
  21.            (long) selfptr, (long) &selfptr);
  22.     printf("these should be equivalent but different: %p, %p\n",
  23.            (long) selfptr2, (long) &selfptr2);
  24.     printf("you should see \"hello, world\" twice:\n");
  25.     bsssym = 0xF00D;
  26.     commvar = 0xD00F;
  27.     function(text);
  28.     printf("this should be 0xF00E: 0x%X\n", bsssym);
  29.     printf("this should be 0xD00E: 0x%X\n", commvar);
  30.     return 0;
  31. }
  32.