Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to pass callback from mach-o to CFM



At 21:58 Uhr +0900 28.08.2003, Kiyoto Takeuchi wrote:
Also I could not understand acttually your code below.
void * NewCFMFromMachO(void * inMachoFunctionPtr)
{
void * result = NewPtr(8);
((void**)result)[0] = inMachoFunctionPtr;
((void**)result)[1] = result;
return result;
}
I guess your code simply slide [1] (second member of array) of marh-o
pointer.

Would you lindly explain outline of this method?
Do it require the understanding MACH-O Runtime architecture?
(I would like to know why the code work fine.)

Actually, it requires understanding the CFM runtime architecture. CFM uses "transition vectors" instead of real ProcPtrs, which are a data structure that contains the actual function pointer and some context information.

For MachO functions this isn't really needed, so what this code does is build a fake TVector with the MachO ProcPtr, so the CFM code can call it. Why he's passing the "result" pointer as the context pointer is beyond me, though. George Warner (Apple's CFM guy) told me to just pass zero there.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: How to pass callback from mach-o to CFM (From: Kiyoto Takeuchi <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.