Smart. I'm not sure how solid this is though: you would have to build the dynamic lib exactly as the static binary (same arch, subarch, optimizations, etc...). Now that I think about it I'm even surprised it worked at all in his example.
I'd definitely look for init code for some calculation (as it appears the author has done here), rather than actual computation code, since, as you point out, optimizations could have a huge impact on the instructions emitted for those.