Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exe & dlls freeing allocated memory

Status
Not open for further replies.

9223626

Programmer
Jan 9, 2002
3
IL
Hello,

I would like to allocate memory at my exe program ,
pass it to a dll ,
free this memory in the dll .


xxx.EXE
===========
BYTE *bt = new BYTE[8] ;
//call dll function and pass it (bt) ;


yyy.DLL
====================

delete bt ;


Thanks in advance
 
Why not pass the application pointer to your dll? Then, you don't need to directly access the allocated memory, but use the application pointer to have member functions in the main application do the work for you:

GetMyStuff(), SetMyStuff(), ClearMyStuff() or FreeMyStuff()... or whatever other member functions you want.
 
Thanks ,

To save the function call back to the exe for freeing and allocating . I would like to free it in the DLL
BUT it crashes!!!!.
Does any body have any idea?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top