The Library flourished under the patronage of the Ptolemaic dynasty and functioned as a major center of scholarship . It was built in the third century BC . It flourished under the patronage of the Ptolemaic dynasty and functioned as a major center of scholarship from its construction in the 3rd century BC until the Roman conquest of Egypt in 30 BC .