I tried building the Alan2 interpreter against Windows Glk with a modern MinGW compiler, and ran into a few issues that are fixed here.
The most finicky is the workaround for Alan's redefinition of printf. The supplied glkio_printf prototype doesn't necessarily match with standard headers, causing conflicting definitions for printf itself. But if stdio.h is included before Alan's redefinition, all is good: the standard header doesn't see the renaming, but the rest of Alan does.
I also had to invent a macro for if a Unix Glk startup is wanted: the code previously did a Unix startup unconditionally, then conditionally did a Windows Glk startup. Following the Windows macro, I wrapped the Unix startup in a UNIXGLK macro. This does change behavior, so anybody who was using this before needs to define UNIXGLK. If this is too onerous, it could be changed so that Unix is implied if WINGLK isn't set.
I tried building the Alan2 interpreter against Windows Glk with a modern MinGW compiler, and ran into a few issues that are fixed here.
The most finicky is the workaround for Alan's redefinition of
printf
. The suppliedglkio_printf
prototype doesn't necessarily match with standard headers, causing conflicting definitions forprintf
itself. But ifstdio.h
is included before Alan's redefinition, all is good: the standard header doesn't see the renaming, but the rest of Alan does.I also had to invent a macro for if a Unix Glk startup is wanted: the code previously did a Unix startup unconditionally, then conditionally did a Windows Glk startup. Following the Windows macro, I wrapped the Unix startup in a
UNIXGLK
macro. This does change behavior, so anybody who was using this before needs to defineUNIXGLK
. If this is too onerous, it could be changed so that Unix is implied ifWINGLK
isn't set.