views:

29

answers:

2

I have this situation where an EXE program imports a DLL for a single function call. It works by passing in a custom structure and returning a different custom structure. Up till now it's worked fine until I wanted one of the structs data members to be a vector < MyStruct >

When I do a sizeof(vector< MyStruct >) in my program I get a size of 20 but when I do it from inside the DLL I get a size of 24. This size inconsistency is causing a ESP pointer error.

Can anyone tell me why a Vector < MyStruct > would be a different size in the DLL than in the program?

I have reverified that my structs in both the DLL and the Program are identical.

I would appreciate any help on the subject. Thank you.

A: 

This could be due to a compiler option that controls how data structures are packed.

jdigital
A: 

I have the same problem, but in my case both EXE and DLL are release builds. The DLL however is using MFC, while the EXE does not. I have checked out the _HAS_ITERATOR_DEBUGGING flag but that isn't on for any of the projects so that's not the problem either. Any new ideas would be appreciated!

boxed