In a medium saucepan, combine sugar, salt, cornstarch, and flour. Gradually stir in milk, evaporated milk, and coconut. Cook over low heat, stirring constantly, until mixture comes to a boil. Boil 1 minute, continuing to stir.
Remove from heat.
Place egg yolks in a medium bowl. Slowly pour 1 cup of milk mixture into egg yolks, whisking constantly.
Whisk egg yolk mixture back into remaining milk mixture in saucepan.
Return mixture to heat. Bring to a boil, then boil for one minute, stirring constantly.
Remove from heat. Stir in butter or margarine and vanilla extract.
Pour mixture into baked pastry shell. Chill at least 3 hours before serving.