Is there a way to create a handle from an already existing memory
area? For example, can I do something like this:
Char *myP = new char[100];
Handle myH = MemoryToHandle (myP, 100);
No. There never has been. If there were, it would be in MacMemory.h.
If you anticipate needing the functionality of a Handle you should
allocate the memory that way initially.
Besides, if you did something like the above it wouldn't work anyway.
The memory in your example was allocated with a C++ new allocation.
You then pass it off to a Memory Manager data type, which would
ultimately release it with free instead of your C++ delete. It needs
to be released with:
delete [] myP;
and that's not going to happen inside DisposeHandle.
You've been programming for a long time. Why are you asking such
questions?
Larry
I saw there is a PtrToHand and PtrToXHand, but they use copying.
Thanx
Yaron Tadmor
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden