Partial fix for #5555. Add const,pure attributes to library.