Sign in Join
Wiki copytemporary

Win16

Overview

A Win16 cross compiler is currently being developed in FPC trunk (the development version). It targets Windows 3.0 or later.

Requirements

FPC trunk

The compiler is a cross compiler that runs at least on Windows (both x86 and x64), Linux, and Mac OS X. For compiling programs, it needs:

In theory it should be able to run on any platform, supported by FPC, where NASM and the Open Watcom tools are available. This includes DOS via the GO32V2 extender. However, because the Watcom tools for DOS are compiled with a different extender, there are some issues related to long file names and the passing of long command line arguments.

Building a snapshot manually

pascal
git clone -b main <https://gitlab.com/freepascal.org/fpc/source.git> fpc
pascal
make clean all OS_TARGET=win16 CPU_TARGET=i8086 OPT="-CX -XXs" CROSSOPT=**-WmLarge** BINUTILSPREFIX= PP=**/usr/bin/ppc386**
pascal
make crossinstall OS_SOURCE=**linux** CPU_SOURCE=**i386** OS_TARGET=win16 CPU_TARGET=i8086 PP=compiler/ppcross8086 CROSSOPT=**-WmLarge** \
        BINUTILSPREFIX= INSTALL_PREFIX=**/home/blablabla/fpc-i8086/snapshot-win16/large** OPT="-CX -XXs"

Status

The RTL compiles. Note that not all packages work in memory models, other than large or medium. This is because, currently the small and compact memory models don't support generating far procedures (the far directive is ignored in these models), and that's what the Win16 API expects to use for callback functions. The RTL supports long file names when run under Windows 95+/2000+. The dos unit works (unlike Borland Pascal 7, it is still called dos and not windos). Most of the core win16 api is available through the wintypes and winprocs units, similarly to Borland Pascal 7. The win31 unit is also available, providing support for the extra APIs, added in Windows 3.1. The crt , video , keyboard and mouse units compile and work (although there's no mouse supported implemented yet), by providing an emulated text console (since Win16 applications can be GUI only). Note that crt is also called crt (and not wincrt like in BP7). FPC demo program fpctris works. Samegame should also work, as soon as mouse input support is added to the kvm units. FV (Free Vision) also compiles and mostly works, but is not well tested and may have bugs. The sysutils unit compiles, but does not yet work. The graph unit is not yet implemented. However, the objects and objpas units are available and work.

Creating DLLs is not yet supported.

Even though created EXE files are marked to support Windows 3.0 real mode, the real mode support is not stable yet (it needs all functions, including internal ones to be exported, which is not yet implemented). Therefore, running under protected mode Windows is highly recommended.

Screenshot of fpctris, working under Windows for Workgroups 3.11:

fpctris wfwg311.png


From the Free Pascal wiki, page "Win16", as the Internet Archive kept it on 2025-08-18, last changed on 2025-03-10. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 3, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.