# Argument principle for Riemann surfaces

I am basically looking for a good reference for an extension of Cauchy's argument principle on Riemann surfaces. For meromorphic functions on the complex plane, the theorem is the following (hope I get it right).

Theorem (Cauhcy's argument principle). Let $U$ be a simply connected open set of $\mathbb{C}$, let $f:U\to \mathbb{C}$ be a meromorphic function on $U$, let $S\subset U$ be the set of zeros ans poles of $f$, $S$ finite. Then for any closed contour $\gamma: [0,1]\to \mathbb{C}$, that does not intersect itself, and such that $\gamma ([0,1])\subset U\setminus S$, we have $$\frac{1}{2\mathrm{i}\pi} \int_\gamma \frac{f'(z)}{f(z)}\mathrm{d}z = Z(f,\gamma) - P(f,\gamma),$$ where $Z(f,\gamma)$ (respectively $P(f,\gamma)$) is the number of zeros of $f$, counted with multiplicity, that lie within the bounded component of $\mathbb{C}\setminus \gamma ([0,1])$ (resp. the number of poles).

My question is: How exactly does this result extend to the case where $f$ is a meromorphic function on a compact Riemann surface of any genus? I have read that somehow it does, and that it implies that the number of zeros equals the number of poles. But I cannot manage to find a good reference for that precise statement. Does anybody know some?