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



On Thu, 28 Aug 2003, Kiyoto Takeuchi wrote:

> Dear Mr. Poirier
>
> Thank you for your reply.
>
> > // create a CFM function pointer to a Mach-O function
> > translatedFunctionPtr = NewCFMFromMachO((void*)YourOriginalMachoCallback);
> Upper code locate at Mach-O SHLB
>
> > // when you and the CFM app are all done with it
> > DisposeCFMFromMachO(translatedFunctionPtr);
> My call and upper code locate at CFM App,
> Work fine.
> Thanks a lot!
>
> 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.)


I think you do. And I don't have that level of understanding, so I can't
give you an explanation. I just found the code somewhere (I'm pretty sure
in some other Apple sample code) and it works, so I'm happy enough to just
leave the methodology as a mystery...

Marc
_______________________________________________
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.