Click here to Skip to main content
16,006,341 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C++/VB Memory Allocation Pin
Anton A. Loukine24-Nov-03 5:06
Anton A. Loukine24-Nov-03 5:06 
GeneralRe: C++/VB Memory Allocation Pin
David Crow24-Nov-03 5:18
David Crow24-Nov-03 5:18 
GeneralRe: C++/VB Memory Allocation Pin
David Crow24-Nov-03 4:55
David Crow24-Nov-03 4:55 
GeneralRe: C++/VB Memory Allocation Pin
Anton A. Loukine24-Nov-03 5:02
Anton A. Loukine24-Nov-03 5:02 
GeneralRe: C++/VB Memory Allocation Pin
David Crow24-Nov-03 5:27
David Crow24-Nov-03 5:27 
GeneralRe: C++/VB Memory Allocation Pin
Anton A. Loukine24-Nov-03 5:49
Anton A. Loukine24-Nov-03 5:49 
GeneralRe: C++/VB Memory Allocation Pin
David Crow24-Nov-03 5:56
David Crow24-Nov-03 5:56 
GeneralRe: C++/VB Memory Allocation Pin
Anton A. Loukine24-Nov-03 6:07
Anton A. Loukine24-Nov-03 6:07 
I actually tried to implement your suggestion, but they do not seem to work with my code:

In C++, I have:

short _stdcall QrgAlloc( double* dArray )
{
dArray = new double[ 2 ];
dArray[ 0 ] = 2.34;
dArray[ 1 ] = 2.55;
return 1;

}

short _stdcall QrgFree( double* dArray )
{
delete [] dArray;
return 1;
}

In VB, I have:

Dim l As Long
Dim d As Double
Dim nReturn As Integer

nReturn = QrgAlloc(l)
CopyMemory d, l, 4
MsgBox (d)
CopyMemory d, l + 4, 4
MsgBox (d)
nReturn = QrgFree(l)

That outputs wrong values and then crashes when freeing memory. Any thoughts?

Thanks
GeneralRe: C++/VB Memory Allocation Pin
igor196024-Nov-03 12:09
igor196024-Nov-03 12:09 
GeneralRe: C++/VB Memory Allocation Pin
Anton A. Loukine25-Nov-03 2:45
Anton A. Loukine25-Nov-03 2:45 
GeneralRe: C++/VB Memory Allocation Pin
igor196025-Nov-03 6:51
igor196025-Nov-03 6:51 
GeneralRe: C++/VB Memory Allocation Pin
igor196025-Nov-03 7:23
igor196025-Nov-03 7:23 
GeneralRe: C++/VB Memory Allocation Pin
igor196026-Nov-03 7:08
igor196026-Nov-03 7:08 
GeneralRe: C++/VB Memory Allocation Pin
Mike Dimmick24-Nov-03 5:56
Mike Dimmick24-Nov-03 5:56 
QuestionGet docking location of a control bar? Pin
Francis B.24-Nov-03 3:24
Francis B.24-Nov-03 3:24 
GeneralFolder Hide Pin
zichun24-Nov-03 2:49
zichun24-Nov-03 2:49 
GeneralRe: Folder Hide Pin
David Crow24-Nov-03 2:55
David Crow24-Nov-03 2:55 
GeneralProblem with WriteFile Pin
Deepak Samuel24-Nov-03 2:41
Deepak Samuel24-Nov-03 2:41 
GeneralRe: Problem with WriteFile Pin
David Crow24-Nov-03 3:00
David Crow24-Nov-03 3:00 
GeneralRe: Problem with WriteFile Pin
Deepak Samuel24-Nov-03 3:41
Deepak Samuel24-Nov-03 3:41 
GeneralRe: Problem with WriteFile Pin
Roger Allen24-Nov-03 4:27
Roger Allen24-Nov-03 4:27 
GeneralRe: Problem with WriteFile Pin
Adam Gritt24-Nov-03 3:21
Adam Gritt24-Nov-03 3:21 
Generalpointer to member function Pin
El'Cachubrey24-Nov-03 2:14
El'Cachubrey24-Nov-03 2:14 
GeneralRe: pointer to member function Pin
David Crow24-Nov-03 2:24
David Crow24-Nov-03 2:24 
GeneralRe: pointer to member function Pin
Antti Keskinen24-Nov-03 2:41
Antti Keskinen24-Nov-03 2:41 

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.