In a medium saucepan over medium heat, combine sugar, cornflour and salt. Stir in milk and chocolate. Cook, stirring constantly, until chocolate melts and mixture thickens. Remove from heat and stir in egg yolks. Return to heat and cook 2 minutes more. Remove from heat and stir in butter and vanilla. Chill before serving.