2017-11-13
Deen on Windows
My little command-line utility deen has recently been ported to Windows. It was initially intended to run on UN*X-like machines, but it wasn’t too hard to port. Here is what I had to do;
- Downloaded and installed the MinGW build-system.
- The tool uses SQLite to store its data in a simple SQL database. Getting this as a DLL seemed like ‘trouble’ and SQLite offers an “amalgamation” that offers a
sqlite3.h
andsqlite3.c
file to compile into your project. So I switch to using that technique. The makefile was modified to use the well-known toolswget
to pull down the source ZIP file and thenunzip
to decompress the file to get the source. - Windows 10 seems to support coloured text in consoles. All I had to do was enable it with a couple of Windows-specific C function-calls. Console output also had to be set to be UTF-8 as well so that accented characters could be output properly. It was possible to control the Windows-specific logic with
__MINGW__
blocks. - There were a few specifics to opening and closing files and a different approach to looking for the home directory on Windows as well.
make
, flex
and gcc
are there in MinGW so it wasn’t too much trouble to get the build-chain working.
Here’s the result;
On Mac or Linux the terminal is able to show dimmed colour as well which is used by deen. This unfortunately doesn’t work on Windows console, but most of it looks pretty good.