Our recent works have revealed that the magnetic coupling among the magnetic codopants in diluted magnetic semiconductors and doped transition metal oxides has a strong local feature. This was attributed to successive spin polarizations induced by the codopants to their neighboring anion ligands. In the present work, we analyze and refine the successive spin polarization based magnetic coupling using results of ab initio calculations and assign the magnetic coupling among the magnetic codopants to a combination of superexchange and double-exchange interactions. In particular, it is shown that antiferromagnetic successive superexchange interactions can lead to a ferromagnetic coupling between two magnetic dopants mediated by a suitable codopant with the latter forming a ferromagnetic double exchange coupling with its first nearest neighbor anions which couple it with the magnetic cations. This is exemplified by ab initio results for the magnetic coupling of two Co-dopants in the presence of a mediated Cu codopant in the environment of various hosts, namely ZnO, GaN, GaP, TiO2, CdS and SnO2. Additional results for other codopant pairs in various hosts are also presented.