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

C / C++ / MFC

 
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 
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 
>> then it doesn't really make sense why it's not working. <<
I agree, it doesn't make sence...
>> Unless the memory addresses are wiped out by the time the DLL function exists. <<
No, the memory addresses are not wiped out, because you are managing to access values from your VB code (I assume). What is wiped out is Runtime heap allocation info (like MCB blocks and etc). That can only be explained by DLL unloading after each call. I'm not GURU in DLL calls from VB, but it would be interesting to see how you declare those exported C functions in VB (Alias or etc).

What I recommend is to check the lifespan of your DLL, because your DLL code is available to you: put MessageBox or Debug breakpoints in DllMain or InitInstance/ExitInstance in DLL_PROCESS_ATTACH/DETACH and see when DLL loads/freed. That may give you some answers.
Also, you may set breakpoints/MessageBoxs in QrgAlloc( double* dArray ) and QrgFree( double* dArray ) and see if dArray you received in QrgFree is the same as dArray you return from QrgAlloc...

Alternatively, you may consider the following sequence in what you are doing:
imlement your VB/C code in the following manner:
1. Change QrgAlloc( double* dArray ), so it will be able to accept NULL argument as dArray --> in that case, should just return length of next allocation;
2. Allocate array in your VB code equal to the value of QrgAlloc returned on step 1;
3. Call now QrgAlloc( double* dArray ) with dArray equal to VB array allocated on step 2...

So, you don't have to allocate/free anything in C...

Regards

"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
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 
GeneralRe: pointer to member function Pin
Michael Dunn24-Nov-03 4:44
sitebuilderMichael Dunn24-Nov-03 4:44 
Generalmodeless dialog Pin
viliam24-Nov-03 2:07
viliam24-Nov-03 2:07 
GeneralRe: modeless dialog Pin
jhwurmbach24-Nov-03 2:22
jhwurmbach24-Nov-03 2:22 

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.