I believe that targets are marked using a laser.
The effect of a temperature inversion, though, can be significant; it's possible that military laser designators use diverse wavelengths to avoid or compensate for it.
It works by negative feedback, like a servo; all the error terms in the middle cancel out. Neat!
[1] The refraction of a laser by air density variations is bound to be different from the ballistic effects of those same density variations on a bullet passing through them. But it doesn't matter, because the corrections are applied continually along the trajectory, not at the source.