Relativistic study of nuclear-anapole-moment effects in diatomic molecules