Where does Platform switching occur?

Where in the code does the platform switch occur, ie. Assigning WindowsApplication to GenericApplication?