• 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: Bridging (was Re: A CFStringRef that throws EXC_BAD_ACCESS)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bridging (was Re: A CFStringRef that throws EXC_BAD_ACCESS)


  • Subject: Re: Bridging (was Re: A CFStringRef that throws EXC_BAD_ACCESS)
  • From: Simon Stapleton <email@hidden>
  • Date: Mon, 21 Oct 2002 21:19:54 +0200

On Monday, Oct 21, 2002, at 00:55 Europe/Paris, Timothy Ritchey wrote:

Make sure your class has no instance variables - do everything through the CF instance variables. It should be noted, I've yet found no way of actually getting to them besides using the CF methods and passing in self cast to the relevant type...

I'm curious why this would be the case. As long as your class definition matched the instance variables of the CF structure, the offsets should be correct, and you should be able to reference the instance variables.

Ah. I see how it works now. What I'd tried, without success, was as follows:

Lay out the class just like the CFXMLNode, but without the CFRuntimeBase structure (a crasher, generally)
Lay out the class exactly like the CFXMLNode, with the CFRuntimeBase structure as well.

Neither of these work. the second approach is closer, but what you have to do to get it to work is hack the isa pointer out of the runtimebase structure - we've already got one of those, of course.

The final class internals for an XML node look something like this:

uint16_t ignoreMe;
uint16_t ignoreMeToo;
CFIndex version;
CFXMLNodeTypeCode dataTypeID;
NSString * dataString;
void * additionalData;

and we can happily play with the guts of the class without resorting to all sorts of nasty casty stuff.

In my class, I've left it all as a struct, because I'm all paranoid about the compiler moving my variables about all over the place.

W00t!

Simon
--
PGP Key Id : 0x50D0698D
--
Your mouse has moved. You must restart Windows NT for this change to be recognised.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Re: Bridging (was Re: A CFStringRef that throws EXC_BAD_ACCESS) (From: Timothy Ritchey <email@hidden>)

  • Prev by Date: Re: sinf(), cosf() et al
  • Next by Date: NSScanner bug?
  • Previous by thread: Re: Bridging (was Re: A CFStringRef that throws EXC_BAD_ACCESS)
  • Next by thread: Re: Bridging
  • Index(es):
    • Date
    • Thread