It really depends on the individual uni: they'll all have their own different policies about this. I've been at three different unis (undergrad, MA, and current one for PhD). Undergrad one, am pretty sure you can't do this. MA one, not sure but guessing they'd have similar rules but less draconian enforcement.
At my current uni, I think you can use certain uni resources, e.g. Counselling Service and/or disability office if you meet certain criteria (i.e. interrupting on mental health grounds). I'm not sure this extends to library usage though...