I am calling a C DLL from a Delphi 2009 application and I keep getting errors when memory allocated by GetMem or AllocMem is passed to the DLL. The only way around I could avoid these errors was by using malloc from msvcrt.dll. What is malloc doing that the built-in memory routines aren't, and how can I get the built-in ones to work? I really don't like bypassing the built-in memory manager.
Asked
Active
Viewed 763 times
3
-
1What sort of errors are you getting? There shouldn't be any problems unless the C dll tries to free or realloc the memory you passed to it, which it really shouldn't be doing. – Mason Wheeler Nov 10 '09 at 16:02
-
Agreed, but unfortunately "shouldn't be" and "isn't" are different things, and far too frequently so. – qid Nov 10 '09 at 16:05
-
1Thank you for the answer. The dll has an option to take control of the memory and I was using it. I will rewrite my function to keep control of the memory. – Nov 10 '09 at 16:07