Use the marshalling as described in Richards link. A qucick solution is often to make a plain data interface with only using integrated data types like integers and strings.
Allocate the struct and all data in the runtime where you want to use it, so make everytime a local copy.
I have some working code provided in an
article I wrote to help on such questions.