One of the most remarkable and beautiful theorems in coding theory is Gleason's 1970 theorem about the weight enumerators of self-dual codes and their connections with invariant theory. In the past 35 years there have been hundreds of papers written about generalizations and applications of this theorem to different types of codes. This self-contained book develops a new theory which is powerful enough to include all the earlier generalizations. It is also in part an encyclopedia that gives a very extensive list of the different types of self-dual codes and their properties, including tables of the best codes that are presently known. Besides self-dual codes, the book also discusses two closely-related subjects, lattices and modular forms, and quantum error-correcting codes. This book, written by the leading experts in the subject, has no equivalent in the literature and will be of great interest to mathematicians, communication theorists, computer scientists and physicists.