OK, My $0.02:
First: Gunpowder isn't just "Charcoal, Saltpetre, and Sulphur." Yes, those are the ingredients, but the ratios between the ingredients are really critical, and there are some interesting production methods that need to be applied in order to make what we think of as real Gunpowder.
Second, gunpowder itself doesn't explode, it just burn quickly without the need for outside air. without seriously restricting the expansion of the produced gasses, no explosive or propulsive effects will be observed. Alchemists might understand the principles and uses of gunpowder, but in all probability in a magic system, the presence of "Flashing Powder" would probably be the mark of the charlatan. Think of any suggestion of using it in weapons as akin to approaching a general about the combat application of Silly String(tm) (Not that silly string doesn't have combat uses...) Or basing a weapons system on pyramid power.
If we look historically at the period where what we think of as "guns" took over from the Bow-type ranged weapons, we find that there was a period where the gun was a curiosity, rather than an accepted weapon. The reason that guns finally took over was not due to technologies or logistics, but user training. If you start with a raw recruit, with no weapons experience, a musketeer can be trained in a couple of months, while a skilled archer needs a couple of years of intensive training. It's a subtle point, but it's what provided the tipping event in our "guns-vs-bows" debate. 523
If there were other factors involved, that argument could have easily tipped the other way.
Taking this, assume that your magic is Uncommon, rather than Rare. A village shaman or even a military-trained Archomancer could easily provide some enchantments to arrows (increased range, target seeking, improved damage, or magical explosive, just to name a few) that could easily make up for a lower level of training in the archers corps, and would provide a significant, and ready made multiplier to the bow side of the question. This makes guns, while the principle would be understood, a distant second choice on the battlefield.
As to explosives, I don't think that you can restrict those without seriously restricting any industrial capability, or even magical capability. An explosion is a sudden release of energy. Any energy. You're going to have to assume that any rational magical system would have come up with this, even if only by accident. Once the principle is discovered, there's no putting that genie back into its bottle. Under those assumptions, cannons and artillery are almost a given, they just might not be gunpowder-based. 523