Saturday, April 02, 2016

Rain causes Rust

One thing that the wet weather in recent weeks accomplished was to give me some time to play with Rust again, after a go-round a couple of years back, when it still needed to run in an mingw prompt, the code was full of sigils, and I couldn't get an executable to link against advapi32.dll; then again towards the end of 2014 when I migrated a fork of the rust-windows project to the then-current version.

Last year was a bit of a wash all over, coding for fun being one of the major casualties of the year, so it was pretty much a start anew, to build myself a simple "hello world", porting a simple Win32 program to the new language.

It was reasonably easy to find useful samples and fragments from which to Frankenstein together a working program. What I did not find, however, was any good guide to adding resources to the project using the native (rather than the foreign) tool-chain. So I cast around a bit and hacked this together:

It's hacky, since it builds the .rc file to a .res file that actually calls itself a .lib, so that the cargo tool will add the extensionless name as a .lib to the linker, and the linker, fortunately, ignores the file extension and just looks at the file content. It's also hacky in that it hardcodes the path to a local rc.exe, and works arounf the fact that that tool does not offer an output directory parameter by treewalking from the directory where we want to place the output to where the source resides.

I'm sure there must be a better way, but this works. Apart from the fact that a VERSIONINFO compiles OK into the resulting .exe (as can be seen by opening it in Visual Studio), but doesn't show in the file properties. Application icons work just fine, though.

March cycling

A water hazard

Up to 13,933.3, 2689.7 and 16.1, plus 84.3 on cycling holiday (+47.7 in April to count later) meaning 319.6 + 84.3 = 403.9 miles (1090.1 YTD -- so fewer miles than last March, but still ahead in aggregate) in generally nondescript weather mostly at mid-single figures temperatures.

I took a quick post-Easter cycling break again, in weather that promised to be mostly sunny, but never quite delivered -- including surprise hail showers that definitely weren't on the program (but fortunately that day I'd chosen a route that took me out of the path of the most catastrophic deluge, so I just saw the results after the fact).

And, no, that water trap was there the day before -- I'd come down a nice downhill following cycle route signs, when suddenly water ahead, and just carrying through on momentum.

Also, mid month, we finally finished last year's apple crop, despite that having started in mid-August, well earlier than usual.