open-watcom / open-watcom-v2

Open Watcom V2.0 - Source code repository, Wiki, Latest Binary build, Archived builds including all installers for download.
Other
989 stars 162 forks source link

windows 3.1 book help #1217

Closed ghost closed 9 months ago

ghost commented 9 months ago

Hi

I'want to write a windows 3.1 native application but by using a compiler running on windows 10 64 bit. I want to use code from this book

https://github.com/yeokm1/programming-win31

Somebody pointed me to open watcom.

Is this possible and can somebody tell me what settings or options I need to do in open watcom for this? So I want to use the windows api of windows 3.1 and compile a native windows 3.1 program that I can really run on windows 3.1. Can I also debug this in open watcom on windows 10 64 bit?

Ps: i'm a complete beginner in either windows api and open watcom so I need step by step instructions to create my project for this.

jmalak commented 9 months ago

You cannot run or debug Windows 3.1 application directly on 64-bit Windows, but you can compile and link it by OW compiler on 64-bit Windows. Some details how to compile and link are in OW documentation in Wiki.

ghost commented 9 months ago

You cannot run or debug Windows 3.1 application directly on 64-bit Windows, but you can compile and link it by OW compiler.

jmalak commented 9 months ago

You cannot run or debug Windows 3.1 application directly on 64-bit Windows, but you can compile and link it by OW compiler.

  • So yoiu can always compile Windows 3.1 applications on another operating system but in order to debug them you need to run open watcom on windows 3.1 itself? Is that correct?
  • Can a win32 api program (32 bit) be debugged on windows 10 64 bit?

OW is by nature cross-compiler therefore you can compile and link for Windows 3.1 on any supported host OS (DOS, OS/2, Windows, Linux). For 32-bit WIN32 application you can fully compile, link and debug on 64-bit Windows because this OS support 32-bit processes, but not 16-bit.

probably you could use DOSBOX emulator on 64-bit Windows and remote debug by serial link, but I don't know if Windows 3.1 can works under DOSBOX. This way I debug 16-bit DOS program on 64-bit Windows. Here is link for such debug

ghost commented 9 months ago

probably you could use DOSBOX emulator on 64-bit Windows and remote debug by serial link, but I don't know if Windows 3.1 can works under DOSBOX. This way I debug 16-bit DOS program on 64-bit Windows. Here is link for such debug

If I run open watcom 32 bit version on an operating system that can run 16 bit programs (like windows xp), can I debug it then without using dosbox?

jmalak commented 9 months ago

probably you could use DOSBOX emulator on 64-bit Windows and remote debug by serial link, but I don't know if Windows 3.1 can works under DOSBOX. This way I debug 16-bit DOS program on 64-bit Windows. Here is link for such debug

If I run open watcom 32 bit version on an operating system that can run 16 bit programs (like windows xp), can I debug it then without using dosbox?

Windows XP has DOS emulator and 16-bit Windows subsystem, therefore you can debug 16-bit Windows 3.1 applicatiom with OW on Windows Xp without problem. See details in OW debugger guide how to do.

ghost commented 9 months ago

After installing open watcom for win 16 (on windows 3.1 itself), I found several folders which seem to have EXE files NOT for win 16 at all, but they run on windows 64 bit. Is this normal? For example folder binnt and binnt64 are installed using the win 16 installer. Why are they included for a 16 bit OS which can't run them? :)

Is it correct the 16 bit version of open watcom is here? \binw\ide.exe

jmalak commented 9 months ago

OW installation has multiple subdirectory starting with BIN... BINW is DOS/Windows (16-bit) executables BINP is OS/2 executables BINNT is 32-bit Windows executable BINNT64 is 64-bit Windows executable BINL is 32-bit Linux executable BINL64 is 64-bit Linux executable you must setup PATH that include appropriate subdirectory on your HOST system By example if you have 64-bit Windows host you can install 32 or 64 bit version of OW for any target. For your situation Windows Xp is better to install 32-bit version of OW even if you can also use 16-bit version. as soon as you use 16-bit version of OW some limitation can be due to 64 kbytes segment size limitation. any OW version support full set of targets (DOS 16/32-bit, Windows 16/32-bit, OS/2 16/32-bit, Linux 32-bit, Netware, etc.)

ghost commented 9 months ago

GREAT!!!