Ships of the age of sail never had guns so large as to be built into the hull, as its dominant feature, which seems to be what the question is about. Such a gun would be far larger than the ordinary naval guns of the period, with a much heavier projectile.
Metallurgy and casting in the age of sail were simply not up to the task of making a gun of such size that was safe enough and light enough to build a ship around. Had such a thing been built, it would have destroyed the ship when it burst, and no sensible sailor or officer would have been willing to man it.
It would also have been impractical to load, if were it a muzzle-loader, since the ball and charge needed to be rammed firmly into place to get some kind of consistency in loading. Firing a breech-loader of the time with its breech below decks on a wooden ship would have set the ship on fire for certain. Before obdurators were invented, in the nineteenth century, breech-loaders inevitably leaked super-heated gas from the breech.
The ball would have been too heavy to load without a crane, which would have been terribly slow. It would also have missed all the time: naval guns were quite inaccurate, and you needed a number of them to get hits at any significant range. Really, nobody with the faintest glimmer of sense would have tried it, and it never was tried.
Somewhat similar things that did happen were:
Bomb Vessels
These were specialised vessels for bombarding fixed positions on land. They used large mortars, rather than long-barrelled canon or carronades for this task, and fired in high arcs. They were usually fired when the ship was anchored, using two anchors, one each at bow and stern, and aimed by adjusting the ship's positioning via the anchor lines. That allows far more precise aiming than can be achieved from a sailing ship under way. Later ships had the mortars on rotating platforms, but the ship would normally still anchor to fire.
USS Vesuvius
There was a period in the late 19th century, before TNT and other stable explosives became available in quantity, when the only explosives available were black powder, nitro-glycerine and dynamite. Since by this time explosive shells were standard for all naval guns, there was a desire to use more powerful explosives in them than black powder. Nitro-glycerine was impractical and dynamite was too sensitive to fire from ordinary guns - the shells would detonate in the gun's barrel.
There was an attempt to use huge air-guns to fire dynamite shells, and USS Vesuvius was built as a test-bed for them, with three guns built into the hull. Trials showed that the achievable range was too short, and that aiming the ship accurately enough was impractical. The aiming problem could have been solved by firing from anchor, but then the ship would have been exposed to every artillery piece that could be moved close on shore.
Gunboats
There were plenty of
small vessels that had a single large canon on the centreline, but the questions seems to be about full-sized ships.