TeleFlow Forums
http://teleflow.org/phpbb/

memory management with DLL Function
http://teleflow.org/phpbb/viewtopic.php?f=10&t=347
Page 1 of 1

Author:  tomread [ Tue Mar 28, 2006 5:52 pm ]
Post subject: 

I'm not sure how the DLL Function step can work correctly if there is no agreement on memory management functions. I mean, how do you know what memory manager is used to allocate the returned char pointer? What memory manager are you using to free the char pointer that is returned?

Author:  tomread [ Wed Mar 29, 2006 9:52 am ]
Post subject: 

btw, memory allocated by DLL from manufacturer A being freed up by DLL from manufacturer B is a common design error that causes memory corruption. <br> <br>Two solutions is that you can require the DLL to have a Free function that you call to free up the returned char pointer, so the DLL can use the same memory manager that it used to allocate it in the first place. Or you can pass in a function pointer to your Alloc routine.

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/