RTTI Runtime structure data

I'm writing an inter-process shared memory interface and I'd like to share structures with other applications.

Allocating the right amount of memory and assigning a pointer to my structure is easy. Sharing information about the structure's address and size with other applications is also easy (that data is also stored in shared memory). Sharing information about the structure's members (types, names, offsets, array size) is hard!

Right now I have a script to parse my source-code, looking for structures surrounded by a specific macro-keyword, then generates an XML that I need to distribute with my DLL. This script makes assumptions about things like structure padding, is sensitive to syntax, and we always seem to get mismatched XML/DLL which wreaks havoc during runtime.

I'd love to figure out how to access the properties of my structure's elements without this script and to embed these details in the DLL itself (sort of like debug symbols) so that I can pass these details to 3rd party processes via an API-call.

Can anyone suggest a design pattern or other method to achieve this?

Thanks!
Last edited on
If you don't want to use the same struct on both ends the simpliest way to share the data is like you would do it as a file. For instance using the iostream[stringstream] to send all members as string.
Topic archived. No new replies allowed.