is, as Webby
says, a mechanism for igniting the charge of powder in a black-powder
firearm or, in a different context, a term for a firearm which uses such a mechanism.
The history of shoulder arms (and pistols) can be divided around the introduction of the flintlock and its cohort the wheel lock. This is because prior to these two mechanisms, discharging a firearm required the use (and, therefore, preparation in advance) of an existing flame. Burning splints were used initially, or torches for larger arms. The predecessor to the flintlock firearm, the harquebus, solved the problem of having an available flame by the use of the matchlock. This, however, required the user to light the slow match in order to use the weapon. While this was an acceptable means of automating the actual firing in order to allow for better aiming during use, it meant that a weapon could not be kept in a fully 'ready' state - it needed to be prepped before combat, and could only be kept ready for a limited time.
In the fifteenth and sixteenth centuries, the firing mechanisms of shoulder arms (with the advent of the matchlock) became more complex and efficient. The components of the trigger and firing arm (which held the match) were joined by the sear, and migrated into the gun itself (for more information, see harquebus). The term 'lock' came into use as a general name for a firing mechanism, as the craftsmen used to build these relatively complex metal items were originally locksmiths.
The flintlock, in which a hammer with a removable flint is struck against a stationary steel, allowed the ignition of a priming charge without prior preparation of flame. The repeatable location of the spark also allowed the construction of firearms with enclosed flashpans. For the first time, holstered firearms could be fired without any immediate preparatory work. Also, the bright and strong spark produced by flint was superior to that produced by the competing mechanism of the time, the wheel lock; the latter ground a steel wheel against iron pyrites to create a serious of continuous sparks. Although it also allowed for pre-charged weapons, the wheel lock's greater complexity and larger size meant that it was quickly supplanted by the flintlock when the latter became widely available.
The flintlock persisted up through the introduction of the enclosed, all-up cartridge in the German needle gun, invented in 1836. The invention of the percussive primer as a part of the ammunition unit finally obsoleted the flintlock, and the ignition was left to an exposed hammer or firing pin.