One of the challenges of crafting a gingerbread structure is getting the icing just right so that it holds walls together while you’re building. Instructables user all_thumbs tackled that problem head-on by devising a way to essentially make edible glue sticks from sugar.
It starts with molds made from aluminum foil. You can base the mold on an actual glue stick to get the right size. Once you have molds, you fill them with molten sugar, let them cool, and then load them into a hot glue gun and use the gun as you normally would. And yes, you’ll want to use a brand new hot glue gun for this. Glue residue from these guns isn’t nearly as delicious as the paste you ate as a child.
There are some safety concerns to keep in mind, but all in all, this idea sounds effective.
Read about the entire process at Instructables.