The response of mesoscopic superconductors to an ac magnetic field is numerically investigated on the basis of the time-dependent Ginzburg-Landau equations (TDGL). We study the dependence with frequency ω and dc magnetic field H dc of the linear ac susceptibility χ(H dc , ω) in square samples with dimensions of the order of the London penetration depth. At H dc = 0 the behavior of χ as a function of ω agrees very well with the two fluid model, and the imaginary part of the ac susceptibility, χ"(ω), shows a dissipative a maximum at the frequency νo = c 2 /(4πσλ 2 ). In the presence of a magnetic field a second dissipation maximum appears at a frequency ωp ≪ ν0. The most interesting behavior of mesoscopic superconductors can be observed in the χ(H dc ) curves obtained at a fixed frequency. At a fixed number of vortices, χ"(H dc ) continuously increases with increasing H dc . We observe that the dissipation reaches a maximum for magnetic fields right below the vortex penetration fields. Then, after each vortex penetration event, there is a sudden suppression of the ac losses, showing discontinuities in χ"(H dc ) at several values of H dc . We show that these discontinuities are typical of the mesoscopic scale and disappear in macroscopic samples, which have a continuos behavior of χ(H dc ). We argue that these discontinuities in χ(H dc ) are due to the effect of nascent vortices which cause a large variation of the amplitude of the order parameter near the surface before the entrance of vortices.