For a given polynomial $V(x)in mathbb C[x]$, a random matrix eigenvalues measure is a measure $prod_{1leq i<jleq N}(x_i-x_j)^2 prod_{i=1}^N e^{-V(x_i)}dx_i$ on $gamma^N$. Hermitian matrices have real eigenvalues $gamma=mathbb R$, which generalize to $gamma$ a complex Jordan arc, or actually a linear combination of homotopy classes of Jordan arcs, chosen such that integrals are absolutely convergent. Polynomial moments of such measure satisfy a set of linear equations called loop equations. We prove that every solution of loop equations are necessarily polynomial moments of some random matrix measure for some choice of arcs. There is an isomorphism between the homology space of integrable arcs and the set of solutions of loop equations. We also generalize this to a 2-matrix model and to the chain of matrices, and to cases where $V$ is not a polynomial but $V(x)in mathbb C(x)$.