• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unknown PowerPC Exception instead of callback from a framework in a CFM project (CFNetwork)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unknown PowerPC Exception instead of callback from a framework in a CFM project (CFNetwork)


  • Subject: Re: Unknown PowerPC Exception instead of callback from a framework in a CFM project (CFNetwork)
  • From: Quinn <email@hidden>
  • Date: Thu, 3 Apr 2003 10:13:22 +0100

At 11:59 -0500 2/4/03, Francois Boissonneault wrote:
Now I might be wrong again, but I think it has difficulties to find the callback - since I'm using a kind of "wrapper" to get all the pointers to functions with the bundle thing.

CFM functions pointers are pointers to TVectors. Mach-O function pointers are pointers to the actual code. Passing function pointers directly between architectures causes lots of problems. The solutions are as follows:

o If you have a Mach-O function pointer that you want to pass to CFM, you can simply create a dummy TVector (first word contains the Mach-O function pointer, second word contains NULL), and pass the address of that.

o If you have a CFM function pointer that you want to pass to Mach-O, you must create a crazy trampoline structure that recovers the CFM TOC register from thin air. There's code for doing this in the "CFM MachO CFM" sample on our web site.

<http://developer.apple.com/samplecode/Sample_Code/Runtime_Architecture/CFM_MachO_CFM.htm>

Note that, if you're using a bundle, you can call CFBundleGetFunctionPointerForName and it will automatically do the right thing, depending on the runtime of the caller and the runtime of the bundle. This is why your CFM -> Mach-O glue works for calling Mach-O functions from CFM. However, there's no equivalent mechanism for wrappers arbitrary function pointers for use by Mach-O.

S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: broadcast to 255.255.255.255
  • Next by Date: Re: broadcast to 255.255.255.255
  • Previous by thread: Re: broadcast to 255.255.255.255
  • Next by thread: BSD socket performance problem
  • Index(es):
    • Date
    • Thread