The geometric Langlands correspondence for complex curves is traditionally formulated in terms of sheaves rather than functions. Recently, Langlands asked whether it is possible to construct a function-theoretic version. In this paper we use the algebra of commuting global differential operators (quantum Hitchin Hamiltonians and their complex conjugates) on the moduli space of G-bundles of a complex algebraic curve to develop such a theory. We conjecture a canonical self-adjoint extension of the symmetric part of this algebra acting on an appropriate Hilbert space and link its spectrum with the set of opers for the Langlands dual group of G satisfying a certain reality condition, as predicted earlier by Teschner. We prove this conjecture for G=GL(1) and in the simplest non-abelian case.