OBNC – Frequently asked questions (FAQ)

Input problems on macOS


When using the basic module Input or XYplane on macOS, why is keyboard and mouse input not working correctly? How do I solve the problem?


The implementation of Input and XYplane uses the C library SDL. On macOS the header file SDL.h must be included in the file where the function main is defined, that is in the C file which corresponds to the entry point Oberon module. When an Oberon module which imports Input or XYplane is compiled, OBNC is not aware of the SDL library since it is abstracted away by the imported modules. Therefor, OBCN cannot add the required SDL include directive in the generated C code.

There is, however, a workaround for the problem which uses the C preprocessor option -include. This option is supported by the C compilers GCC and Clang. For the entry point module myprog, create the file myprog.env with the content

CFLAGS="-include SDL/SDL.h"

This will make the C preprocessor include SDL.h when myprog.c is compiled.