Click here to Skip to main content
15,896,063 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCListCtrl and lParam Pin
t2x14-Feb-06 11:55
t2x14-Feb-06 11:55 
AnswerRe: CListCtrl and lParam Pin
Michael Dunn14-Feb-06 16:41
sitebuilderMichael Dunn14-Feb-06 16:41 
GeneralRe: CListCtrl and lParam Pin
t2x14-Feb-06 22:25
t2x14-Feb-06 22:25 
GeneralRe: CListCtrl and lParam Pin
Michael Dunn17-Feb-06 9:27
sitebuilderMichael Dunn17-Feb-06 9:27 
GeneralRe: CListCtrl and lParam Pin
Dan McCormick15-Feb-06 11:46
Dan McCormick15-Feb-06 11:46 
GeneralRe: CListCtrl and lParam Pin
t2x16-Feb-06 1:19
t2x16-Feb-06 1:19 
GeneralRe: CListCtrl and lParam Pin
Dan McCormick16-Feb-06 6:18
Dan McCormick16-Feb-06 6:18 
QuestionCan STL vector cross DLL boundaries? Pin
unjedai14-Feb-06 8:30
unjedai14-Feb-06 8:30 
I have some code that I want to split off into it's own dll. Can I have the following method in the DLL and call it from a Client, like this?
// DLL file

void DllFunction (std::vector<int> &B)
{
  B.push_back(1);
}

 ----------------------

// Client file

void SomeFunction ()
{
  std::vector<int> A;

  DllFunction(A);
}

This works fine when all the code is in the same project but when I split off the DllFunction into it's own Dll, I get errors. I get a runtime error in _CrtIsValidHeapPointer (dbgheap.c) when SomeFunction returns. I suppose the problem is that the DLL allocates the memory and the Client is trying to free it and that's bad.

So, what do people do when they want to pass an STL vector as a reference parameter to a DLL? Cannot such a basic thing as this be done? Do I have to redesign things now that the code is in a Dll? I've looked at MS Knowledge Base Q168958 but it doesn't seem to help me.

I've made sure my runtime libraries are the same for the dll and the client (/MTd), but that didn't fix the problem.
AnswerRe: Can STL vector cross DLL boundaries? Pin
Michael Dunn14-Feb-06 10:14
sitebuilderMichael Dunn14-Feb-06 10:14 
AnswerRe: Can STL vector cross DLL boundaries? Pin
Jeff Thompson14-Feb-06 10:17
Jeff Thompson14-Feb-06 10:17 
AnswerRe: Can STL vector cross DLL boundaries? Pin
Stephen Hewitt14-Feb-06 11:28
Stephen Hewitt14-Feb-06 11:28 
AnswerRe: Can STL vector cross DLL boundaries? Pin
Anthony_Yio14-Feb-06 15:37
Anthony_Yio14-Feb-06 15:37 
QuestionStrange variations Pin
hint_5414-Feb-06 8:27
hint_5414-Feb-06 8:27 
AnswerRe: Strange variations Pin
David Crow14-Feb-06 9:46
David Crow14-Feb-06 9:46 
GeneralRe: Strange variations Pin
hint_5415-Feb-06 6:22
hint_5415-Feb-06 6:22 
AnswerRe: Strange variations Pin
Stephen Hewitt14-Feb-06 11:34
Stephen Hewitt14-Feb-06 11:34 
AnswerRe: Strange variations Pin
Dan McCormick14-Feb-06 13:37
Dan McCormick14-Feb-06 13:37 
GeneralRe: Strange variations Pin
hint_5415-Feb-06 5:36
hint_5415-Feb-06 5:36 
NewsRe: Strange variations Pin
Dan McCormick15-Feb-06 11:10
Dan McCormick15-Feb-06 11:10 
QuestionFormat of data in writing file , on different Windows Pin
zahid_ash14-Feb-06 8:14
zahid_ash14-Feb-06 8:14 
AnswerRe: Format of data in writing file , on different Windows Pin
Red Stateler14-Feb-06 8:57
Red Stateler14-Feb-06 8:57 
QuestionSerial port interfacing Pin
srija14-Feb-06 7:02
srija14-Feb-06 7:02 
AnswerRe: Serial port interfacing Pin
Milton Karimbekallil14-Feb-06 8:16
Milton Karimbekallil14-Feb-06 8:16 
AnswerRe: Serial port interfacing Pin
Dan McCormick14-Feb-06 8:29
Dan McCormick14-Feb-06 8:29 
QuestionWinsock2.h and "unresolved external error" Pin
Mutty14-Feb-06 6:53
Mutty14-Feb-06 6:53 

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.