A gun barrel is the tube, usually metal, through which a controlled explosion or rapid expansion of gases are released in order to propel a projectile out of the end at a high velocity.
The first guns were made in a time where metallurgy was not advanced enough to cast tubes able to withstand the explosive forces of early cannon, so the pipe (often actually built from staves of metal) needed to be braced periodically along its length, producing an appearance somewhat reminiscent of a storage barrel.
Another explanation, tied to etymology, states that many very first firearms barrels were in fact realized, during the 12th and 13th centuries, using small storage barrels with their usual metal rings reinforced by leather, hence the barrel name. In fact a set of old French words, some of them staying in modern French, were used as root words for various English terms related to firearms (and storage barrels). The old French gonne (pronounced by a French speaker it sounds approximately as gun does when pronounced by an English speaker) was a small barrel used on merchant and military ships. Likewise a baril was, as early as 1323 (used in Du Chevalier au barisel), and remains now, a big barrel. Moreover the big Tun English barrel is, as stated in Ton, the French old and contemporary tonne barrel.
Modern day gun barrels are sophisticated in their construction and makeup. A gun barrel must be able to hold in the expanding gas produced by the propellants to ensure that optimum muzzle velocity is attained by the bullet or shell as it is being pushed out by the expanding gas(es). Early firearms were mostly muzzle loading (loaded from the mouth rather than the breech), which tends to be a slow and complicated procedure, resulting in a low rate of fire. Breech loading provided a higher rate of fire, but early breech loading guns lacked an effective way of sealing the escaping gases that leaked from the back end of the barrel; resulting in a lower muzzle velocity. During the 19th century, effective mechanical locks were invented that allowed loading from the breech while effectively sealing the breech from escaping propellant gases.
Gun barrels are mostly of metal construction. The early Chinese, the inventors of gunpowder, used bamboo, a naturally tubular wood, as the first barrels in gunpowder projectile weapons. Early European guns were made of wrought iron, usually several bands of the metal arranged around circular wrought iron rings and then welded into a hollow cylinder. The Chinese were the first to master cheap cast-iron cannon barrels. Bronze and brass were favoured by gunsmiths, due to their ease of casting and their ability to resist the corrosion created by the combustion of gunpowder. Early cannons were hugely thick for the caliber that they fired. Early manufacturing defects (such as air bubbles trapped in the metal) were key factors in many gun explosions, when the expanding gases became too much for the weak barrel, causing it to rupture and explode in deadly fragments.
Generally the term "smallbore" refers firearms whose bore diameter is 0.299" or less. These are generally used for target shooting and hunting small game.