Kilmarnock have confirmed the signing of Scotland international and former Hearts defender Darren Barr.