www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - getting 32bit helllo world to work?

reply "Jay Krell" <jay.krell cornell.edu> writes:
Um..I'm confused. I generally know what I'm doing, but I can't get a 32bit
DOS "hello world" to work. I've tried under Windows NT 4 and Windows XP.

In NT 4, I had the CD 8.1x installed (ie: xcopied), I overlaid the 8.25
files.
I was getting a USE16/DGROUP32 warnings. That may have been before I
downloaded the x32 files (I had stupidly tried just compiling an empty file
cx.c to get cx.obj).
I copied \x32\lib to \dm\lib.
I can build ok now.

Running a hello world on NT4 results in ntvdm errors.
Running on Windows XP, where I just downloaded and extracted the 8.25 files,
no CD, nothing happens. (ok, not quite nothing, I do lose the scrollback in
cmd, which is usual for running 16bit apps).

C:\>del hello.exe

C:\>type hello.c
#include <stdio.h>

int main()
{
  fprintf(stderr, "Hello, world\n");
  return 0;
}

C:\>sc -v -mx hello.c  x32.lib
scppn -v -mx hello.c
Digital Mars C/C++ Compiler Version 8.25.1n
Copyright (C) Digital Mars 2000-2001.  All Rights Reserved.
Written by Walter Bright
www.digitalmars.com
 'hello.c'
  'c:\dm\bin\..\include\stdio.h'
main
C/C++ Compiler complete. Code: 0x0015 (21) Data: 0x000e (14) Time: 0.10
seconds

link cx+hello,hello,,x32/noi;

C:\>hello.exe

C:\>

??

 - Jay
Jan 07 2002
parent reply Heinz Saathoff <hsaat bre.ipnet.de> writes:
Jay Krell wrote...
 Um..I'm confused. I generally know what I'm doing, but I can't get a 32bit
 DOS "hello world" to work. I've tried under Windows NT 4 and Windows XP.
 
 In NT 4, I had the CD 8.1x installed (ie: xcopied), I overlaid the 8.25
 files.
 I was getting a USE16/DGROUP32 warnings. That may have been before I
 downloaded the x32 files (I had stupidly tried just compiling an empty file
 cx.c to get cx.obj).
 I copied \x32\lib to \dm\lib.
 I can build ok now.

That will not work. For a DOSX program a special obkect file CX.OBJ is needed. This is included in the dos extender zipfile. Use the original CX.OBJ as first obj to the linker You should also not use the CX.OBJ from the Symantec library with the X32.LIB from the extender zip-file!
 link cx+hello,hello,,x32/noi;

Looks ok as long as CX.OBJ and X32.LIB are from the dosextender zipfile. Regards, Heinz
Jan 08 2002
parent "Jay Krell" <jay.krell cornell.edu> writes:
ok..nevermind. I finally figured out that I had my cx.obj compiled from an
empty cx.c still sitting there and the linker was picking it up. My .exe
didn't even work under DOS. I got it working now. Very cool. Thanks.

"Heinz Saathoff" <hsaat bre.ipnet.de> wrote in message
news:MPG.16a4c7e8b7dff6db989699 news.digitalmars.com...
 Jay Krell wrote...
 Um..I'm confused. I generally know what I'm doing, but I can't get a


 DOS "hello world" to work. I've tried under Windows NT 4 and Windows XP.

 In NT 4, I had the CD 8.1x installed (ie: xcopied), I overlaid the 8.25
 files.
 I was getting a USE16/DGROUP32 warnings. That may have been before I
 downloaded the x32 files (I had stupidly tried just compiling an empty


 cx.c to get cx.obj).
 I copied \x32\lib to \dm\lib.
 I can build ok now.

That will not work. For a DOSX program a special obkect file CX.OBJ is needed. This is included in the dos extender zipfile. Use the original CX.OBJ as first obj to the linker You should also not use the CX.OBJ from the Symantec library with the X32.LIB from the extender zip-file!
 link cx+hello,hello,,x32/noi;

Looks ok as long as CX.OBJ and X32.LIB are from the dosextender zipfile. Regards, Heinz

Jan 08 2002