We present the complete next-to-leading order QCD corrections to the polarized hadroproduction of heavy flavors. This reaction can be studied experimentally in polarized pp collisions at the JHF and at the BNL RHIC in order to constrain the polarized gluon density. It is demonstrated that the dependence on the unphysical renormalization and factorization scales is strongly reduced beyond the leading order. We also discuss how the high luminosity at the JHF can be used to control remaining theoretical uncertainties. An effective method for bridging the gap between theoretical predictions for heavy quarks and experimental measurements of heavy meson decay products is introduced briefly.