Harriet,
I'm not entirely sure if this applies, but since I suffered from stomach aches for most of my young life, I thought I'd share in the chance that it might help. While I ate lots as a child, I also had trouble gaining weight. I would struggle with feeling bloated and waking up in the middle of the night with pain.
It wasn't until I was able to control the stomach pain that I started gaining weight again. I am currently on a capful of Miralax every night after dinner. It keeps the pipes working and keeps me pain free. (Running also does the trick)
We went through many "diagnoses" with my stomach aches before realizing it was just DIOS and that Miralax would solve it. I remember being able to literally feel the bowel getting stuck and almost popping out a little bulge on the side of my stomach (thought it was a hernia at one point) until I would massage it back in. I found that eating large meals made it worse. Small meals more often seemed to help.
That said, I would often take salt tablets when I was involved in sports, especially in the summer. A lack of salt can cause dehydration and on a smaller scale, the lack of water can make stools harder and more difficult to pass.
Hope that helps!