Sunday, July 31, 2016

July Cycling

Up to 14,222.8, 3637.1 and 86.5, meaning 4.4 + 288.0 + 64.2 = 356.6 miles (2451.1 YTD -- and slightly behind where I was last year at this time).


The month started better than June had been, so inspiring me to start the month by filling in the wedge at Burwell, but was overall somewhat so-so, despite the real heatwave around the 20th. A week away at the end of the month meant no commuting miles, but just a few shortish rides for pub lunches, on the folding bike, around what became disappointingly wet weather.

Sunday, July 24, 2016

Another little MSVC Rust gotcha.

I've now set up VSCode with Rust on three machines -- the first two went without a hitch; the latest simply refused when running cargo install racer to compile kernel32-sys, with a x86/x64 mismatch.

And running dumpbin /headers on the system libraries mentioned in the dump of the failing link command, sure enough the x86 versions were being picked up by default. Now, going in and doing environment surgery started to unblock the system, but I wanted to figure out why this machine was giving problems.

Much scratching of head later, I realised that the first machine I'd run the command in a PowerShell window without running the Visual Studio VSVARS32.BAT, and that on the second, though I had run that environment set-up as part of my PowerShell profile, that one was running WinX/x86.

Moral of the story -- don't run cargo install from a Visual Studio prompt.

Monday, July 04, 2016

Rain brings on the 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 hard-codes the path to a local rc.exe, and works around the fact that that tool does not offer an output directory parameter by tree-walking 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.

June Cycling

The rainy season that usually wipes out April/May cycling waited until the Late Spring Bank Holiday. This means that the totals for the month are 14218.4/3349.1 + 10.7 off-meter -- meaning 90.4 + 196.2 + 10.7 = 297.3 miles, or 2094.5 YTD, only slightly shy of my 2100 target for the half-year, even so. That is to say, despite logging the fewest miles of any month this year, even February, and 2/3 what I did in the same month last year, I'm still just ahead of last year's total.