Click here to Skip to main content
14,267,879 members

ATL / WTL / STL

 
GeneralRe: Enable a control/window in an MFC dialog, Resolved Pin
bkelly139-Oct-14 0:34
memberbkelly139-Oct-14 0:34 
Questioncontrol ID not found, Resolved Pin
bkelly135-Oct-14 14:25
memberbkelly135-Oct-14 14:25 
AnswerRe: control ID not found Pin
Richard MacCutchan5-Oct-14 23:46
protectorRichard MacCutchan5-Oct-14 23:46 
GeneralRe: control ID not found Pin
bkelly136-Oct-14 14:52
memberbkelly136-Oct-14 14:52 
GeneralRe: control ID not found Pin
Richard MacCutchan6-Oct-14 21:33
protectorRichard MacCutchan6-Oct-14 21:33 
GeneralResolved Pin
bkelly137-Oct-14 14:31
memberbkelly137-Oct-14 14:31 
GeneralRe: Resolved Pin
Richard MacCutchan7-Oct-14 22:24
protectorRichard MacCutchan7-Oct-14 22:24 
QuestionStruct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 18:15
memberJacobkingsly1-Oct-14 18:15 
I have the following structure defined inside my DLL and a COM component we developed.

struct ContentStr
{
ContentStr():ptr(NULL), contSize(0), structSize(0), X(0), Y(0){}
const BYTE* ptr;
int contSize;
int structSize;

//output
std::vector<byte> m_v_Data;
int X;
int Y;


private:
ContentStr ( const ContentStr & rhs );
ContentStr & operator= ( const ContentStr & rhs );
};


The COM component invokes a DllExport method in the DLL which accepts the structure as reference and fills its value. It was working fine in VS2008. Recently I ported my code base to VS2013. Now the method throws exception when invoked. When I checked the size of the structure using sizeof operator, I was surprised a bit.



VS 2008:

/*Inside COM*/ sizeof(ContentStr) = 40

/*Inside DLL*/ sizeof(ContentStr) = 40

VS 2013:

/*Inside COM*/ sizeof(ContentStr) = 36

/*Inside DLL*/ sizeof(ContentStr) = 32



I could see that the difference in size is due to the difference in vector size. Searching the internet gave me huge confusion hence I am posting this question on the expert forum. Could someone please explain me why is this difference seen in the sizes and help me find a solution.
Kings

QuestionRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan1-Oct-14 21:31
protectorRichard MacCutchan1-Oct-14 21:31 
AnswerRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 23:05
memberJacobkingsly1-Oct-14 23:05 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan1-Oct-14 23:13
protectorRichard MacCutchan1-Oct-14 23:13 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 23:26
memberJacobkingsly1-Oct-14 23:26 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan1-Oct-14 23:29
protectorRichard MacCutchan1-Oct-14 23:29 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 23:31
memberJacobkingsly1-Oct-14 23:31 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Richard MacCutchan1-Oct-14 23:35
protectorRichard MacCutchan1-Oct-14 23:35 
AnswerRe: Struct with Vector<BYTE> size different in VS2013 Pin
Vi21-Oct-14 21:56
memberVi21-Oct-14 21:56 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 23:11
memberJacobkingsly1-Oct-14 23:11 
AnswerRe: Struct with Vector<BYTE> size different in VS2013 Pin
Shao Voon Wong1-Oct-14 21:56
mvaShao Voon Wong1-Oct-14 21:56 
GeneralRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly1-Oct-14 23:11
memberJacobkingsly1-Oct-14 23:11 
AnswerRe: Struct with Vector<BYTE> size different in VS2013 Pin
Jacobkingsly3-Oct-14 3:27
memberJacobkingsly3-Oct-14 3:27 
QuestionPointer to a function parameter Pin
econy24-Sep-14 3:01
memberecony24-Sep-14 3:01 
AnswerRe: Pointer to a function parameter Pin
Richard MacCutchan24-Sep-14 5:32
protectorRichard MacCutchan24-Sep-14 5:32 
GeneralRe: Pointer to a function parameter Pin
econy24-Sep-14 6:47
memberecony24-Sep-14 6:47 
GeneralRe: Pointer to a function parameter Pin
Richard MacCutchan24-Sep-14 7:07
protectorRichard MacCutchan24-Sep-14 7:07 
GeneralRe: Pointer to a function parameter Pin
econy24-Sep-14 10:13
memberecony24-Sep-14 10:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.