Click here to Skip to main content
15,879,535 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

I have written a Dll in c++. The Dll has a exposed function in which i allocate run-time memory using new operator. The dll is called from unmanaged multi-thread apps.

I am facing a issue that run-time memory allocation is getting crashed when the client app (C#) call my dll.

Can you help me to which heap-function should i use ?


thanks
Posted
Comments
Sergey Alexandrovich Kryukov 12-Mar-12 13:29pm    
I would need to look at your code. Generally, if you need to do allocation of memory on unmanaged side, you should deallocate it on unmanages side. Perhaps you need to functions instead of one.
--SA

If the caller is responsible for freeing the memory allocated by the .DLL function, the .DLL should also expose a function for the caller to use to free that memory. You should NOT be relying on the caller to know which method of allocation the .DLL used to allocate a block of memory.
 
Share this answer
 
Read this article

http://blogs.msdn.com/b/jonathanswift/archive/2006/10/02/780637.aspx[^]


but only concern is you can not call MFC Extension dll function in your managed code
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900