add declspecs and fix a wrong call to static consts in detect_sizes.