As the cost of increasing RACKs of the real-time digital simulator(RTDS) to enlarge the scale of system simulation is too high, a feasible method is proposed to simulate the marginal AC power grid with the electromechanical transient simulation method, while the AC-DC main grid is simulated with the electromagnetic transient method for RTDS, that is, the realization of the hybrid real-time simulation of power system electromechanical transient and electromagnetic transient process based on RTDS. To this end, the user-defined simulation module of electromechanical transients based on CBuilder is realized, and the module is successfully connected with RTDS electromagnetic transient models. By adopting the technology of multithreading and Gauss network reduction, the computing scale of electromechanical transients simulation is improved. The validity of the electromechanical transients simulation module programmed by CBulider language is proved by IEEE standard data. The module has been successfully applied in the hybrid simulation of electromechanical transient and electromagnetic transient based on RTDS. The hybrid simulation results are validated by comparing with those of all electromagnetic models.