In a medium saucepan, whisk together the sugar, cornstarch, and salt. Add 1 cup of milk, and whisk together until it's smooth. Whisk in the egg yolks until thoroughly mixed.
Cook over medium heat, slowly whisking the rest of the milk into the custard mixture. Bring to a boil, whisking constantly and focusing on the edges to prevent burning. Let it boil for 2 minutes. It should be thick.
Remove the pudding from the heat, and stir in the chocolate, butter, and vanilla extract until smooth. If it's at all lumpy, strain the pudding through a fine-mesh sieve. Let it cool slightly. Press a piece of plastic wrap to the surface to prevent a skin from forming. If you're making it ahead of time, refrigerate the pudding until you're ready to use.