Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

stack

2 views
Skip to first unread message

Paul Edwards

unread,
Feb 19, 2024, 9:11:05 PMFeb 19
to
With Open Watcom 1.6 I get this:

os2test.c:

#include <os2.h>

void os2test(void)
{
ULONG written;

DosWrite(1, "hi\r\nabc\r\n", 9, &written);
DosExit(1, 0);
}

D:\devel\pdos\xxx>wcl386 -ecc -D__OS2__ -D__32BIT__ -bt=os2 -l=os2v2 -wx
-c -I. -I..\src -I..\pdpclib
-y -fpi87 -s -zq -3s -zm -zl -oneatblr os2test.c

D:\devel\pdos\xxx>wlink File os2test.obj Name os2test.exe Form os2 flat
PMCompatible Library os2.
lib Option quiet,start=_os2test,stub=needpdos.exe
Warning! W1014: stack segment not found


And the program refuses to run:

[Z:\]os2test
SYS0189: The operating system cannot run Z:\OS2TEST.EXE.


Forcing me to have some assembler code:

.386

.model flat, c

.stack 800h

end



I don't have that problem on Windows (ie I don't need
to define a stack segment - Watcom does it automatically).

wintest.c:

#include <windows.h>

void wintest(void)
{
DWORD written;

WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), "hi\r\nabc\r\n", 9,
&written, NULL);
ExitProcess(0);
}

D:\devel\pdos\yyy>wcl386 -oneatx -c -ecc -zl -fpi87 -q -D__WIN32__
-D__STATIC__ -I. -I..\src -I..
\pdpclib wintest.c

D:\devel\pdos\yyy>wlink File wintest.obj Name wintest.exe Form windows
nt Runtime con Library kernel32.lib Option quiet,start=_wintest



Any idea what the difference is?

Thanks. Paul.

Peter Flass

unread,
Feb 20, 2024, 7:45:39 PMFeb 20
to
You don’t need assembler. Stack and heap sizes are linker commands.

--
Pete

Peter Flass

unread,
Feb 20, 2024, 7:46:10 PMFeb 20
to
You don’t need assembler, it’s also a link command.

--
Pete

Dave Yeo

unread,
Feb 20, 2024, 8:54:03 PMFeb 20
to
Paul Edwards wrote:
> And the program refuses to run:
>
> [Z:\]os2test
> SYS0189: The operating system cannot run Z:\OS2TEST.EXE.

You can also add/adjust the stack,
>exehdr /?

Operating System/2 Executable File Header Utility
Version 4.01.001 Oct 4 2001
Copyright (C) IBM Corporation 1988-2001
Copyright (C) Microsoft Corp. 1988-1992.
All rights reserved.

Usage: EXEHDR [options] filename...
Valid options are:
/?
/HEAP:(0H - ffffH)
/HELP
/MAX:(0H - ffffH)
/MIN:(0H - ffffH)
/NEWFILES
/NOLOGO
/PMTYPE:(PM | VIO | NOVIO | WINDOWAPI | WINDOWCOMPAT |
NOTWINDOWCOMPAT)
/RESETERROR
/STACKDOS:(0H - ffffH)
/STACKOS2:(0H - ffffffffH)
/VERBOSE

Dave

Paul Edwards

unread,
Feb 20, 2024, 10:09:38 PMFeb 20
to
That would be great, but it doesn't seem to work.

So I put in stack=2048 to match what the assembler has.

D:\devel\pdos\xxx>type doitbad.bat
wcl386 -ecc -D__OS2__ -D__32BIT__ -bt=os2 -l=os2v2 -wx -c -I. -I..\src
-I..\pdpclib -y -fpi87 -s
-zq -3s -zm -zl -oneatblr os2test.c
wlink File os2test.obj Name os2test.exe Form os2 flat PMCompatible
Library os2.lib Option quiet,s
tart=_os2test,stub=needpdos.exe,map,stack=2048


I still get the warning, and a smaller executable:


D:\devel\pdos\xxx>dir os2test.bad os2test.exe
Volume in drive D is PAULDATA
Volume Serial Number is DAB2-6E30

Directory of D:\devel\pdos\xxx

2024-02-21 11:01a 485 os2test.bad

Directory of D:\devel\pdos\xxx

2024-02-21 11:02a 509 os2test.exe


D:\devel\pdos\xxx>hexdump os2test.bad
000000 4D5A7C00 01000000 04004100 FFFF0400 MZ|.......A.....
000010 00040000 00000000 40000000 00000000 ........@.......
000020 00000000 00000000 00000000 00000000 ................
000030 00000000 00000000 00000000 80000000 ................
000040 0E1FB409 BA1000CD 21B001B4 4CCD2100 ........!...L.!.
000050 54686973 2070726F 6772616D 206E6565 This program nee
000060 6473204F 532F3220 322E3020 6F722065 ds OS/2 2.0 or e
000070 71756976 616C656E 740D0A24 00000000 quivalent..$....
000080 4C580000 00000000 02000100 00000000 LX..............
000090 00020000 02000000 01000000 00000000 ................
0000A0 00000000 00000000 00100000 00000000 ................
0000B0 23000000 00000000 4C000000 00000000 #.......L.......
0000C0 C4000000 02000000 F4000000 00000000 ................
0000D0 04010000 00000000 04010000 0F010000 ................
0000E0 00000000 00000000 10010000 1C010000 ................
0000F0 29010000 01000000 32010000 00000000 ).......2.......
000100 B4010000 00000000 00000000 00000000 ................
000110 00000000 02000000 00000000 00000000 ................
000120 00000000 00000000 00000000 00080000 ................
000130 00000000 00000000 00000000 00000000 ................
000140 00000000 27000000 00000100 05200000 ....'........ ..
000150 01000000 01000000 00000000 0C000000 ................
000160 00000200 03200000 02000000 01000000 ..... ..........
000170 00000000 00000000 27000000 27000000 ........'...'...
000180 0A000000 076F7332 74657374 00000000 .....os2test....
000190 00000000 0D000000 0D000000 08011000 ................
0001A0 011A0108 811C0001 EA08444F 5343414C ..........DOSCAL
0001B0 4C530000 83EC0489 E0506A09 68000002 LS.......Pj.h...
0001C0 006A01E8 00000000 83C4106A 006A01E8 .j.........j.j..
0001D0 00000000 83C40883 C404C368 690D0A61 ...........hi..a
0001E0 62630D0A 00 bc...

D:\devel\pdos\xxx>


I can see here:

000120 00000000 00000000 00000000 00080000 ................

that the stack size was set correctly (0800).


I think I did a standard install of ArcaOS, but
I could have selected minimal if it existed.
Either way, I don't seem to have exehdr (thanks Dave),
but even if I did, it doesn't appear to be the problem
given that the header is set correctly:

[C:\]dir exehdr.exe /s

The volume label in drive C is ARCAOS.
The Volume Serial Number is ADE2:7814.

SYS0002: The system cannot find the file specified.

[C:\]


BFN. Paul.

Dave Yeo

unread,
Feb 21, 2024, 9:36:43 AMFeb 21
to
Paul Edwards wrote:
> I think I did a standard install of ArcaOS, but
> I could have selected minimal if it existed.
> Either way, I don't seem to have exehdr (thanks Dave),
> but even if I did, it doesn't appear to be the problem
> given that the header is set correctly:
>
> [C:\]dir exehdr.exe /s
>
> The volume label in drive C is ARCAOS.
> The Volume Serial Number is ADE2:7814.
>
> SYS0002: The system cannot find the file specified.
>
> [C:\]


yum install os2tk45-utils
Will install exehdr.
Dave
Dave

Peter Flass

unread,
Feb 21, 2024, 6:50:08 PMFeb 21
to
EXEHDR is part of the toolkit, which you can download…somewhere.

--
Pete
0 new messages