Originally Posted by
Sebastiani
A structure is just a way for a compiler to know how to lay things out in memory. So the structure definition belongs in a plain old header file, that will be accessible by both the code for the DLL consumer and producer.
The next issue is that exporting an instance of some type from a DLL is problematic. If the layout of the structure is not *exactly* the same for both modules, it won't work. Unfortunately, this generally means both pieces of code must be built by the same compiler on the same machine. On the other hand, if you use a compiler directive to align the structure on some boundary *and* only use non-class types (eg: C-style structures), you might be able to get it to work. Anyway, the safest (and most common) solution is to only pass opaque 'handles' to and from the DLL.
Finally, you are passing to memset a pointer that doesn't point to an actual block of data.