Mimic object constructor in VHDL
I'm about 98% that what you're attempting to do is not possible within VHDL. I've done a bit of digging, and every bit of evidence I can find corroborates my suspicion.

Of the scant information I can find, the only thing that comes close to addressing your question is this post on VHDLGuru where the author points out that you can't even use a generic to set the size of the array, so that doesn't bode well for the dynamic approach you're targeting. (The author does propose using a package to help solve the problem, but that's probably not helpful for your purposes.)


  I am not sure if it is because of lack of the support in the VHDL standard or in GHDL.


I'm not sure either, but you've already proven GHDL doesn't support it and the evidence suggests that "most" tools don't support it so I'd recommend against trying an approach this sophisticated.

If this is just a simulation model, why not just declare bodyy to be an array of fixed size (i.e. the maximum size you would ever require)? You would of course need another variable to track the actual message size, but that could be easily defined using your approach. The only downside to this approach is that your simulation could slow down for super-huge messages, but if you're trying to simulate super-huge messages then you have a problem no matter what approach you take...