|
-
May 10th, 2003, 05:20 AM
#1
Placement new with HeapAlloc
Hi*!
I have a Dll that dll implements a class. I have a class factory kindof function in the DLL that gives me an Object of the class in DLL. I dont want to include any libs in my project for the DLL. The class factory in the Dll does something like
PHP Code:
// Doing some other stuff too
void* pMem = HeapAlloc(GetProcessHeap(), 0, sizeof(CMyDllClass));
return new (pMem) CMyDllClass();
Is it correct??? It works but i want to know if theres a more appropriate way to achieve the same????
Secondly when i dont need the object, what should i do???? delete will also i think delete the memory & If i use Heap functions to delete the memory, then do i have to call the dtor myself?????
Thanks for ur time,
Regards,
Usman.
Last edited by usman999_1; May 10th, 2003 at 05:24 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|