<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Objective-C Object as a C Structure</title>
	<atom:link href="http://MacDeveloperTips.com/objective-c/objective-c-object-as-a-c-structure.html/feed" rel="self" type="application/rss+xml" />
	<link>http://MacDeveloperTips.com/objective-c/objective-c-object-as-a-c-structure.html</link>
	<description>Tips, tools and code for iPhone and Mac developers.</description>
	<lastBuildDate>Fri, 30 Jul 2010 22:59:45 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Dylan Barrie</title>
		<link>http://MacDeveloperTips.com/objective-c/objective-c-object-as-a-c-structure.html/comment-page-1#comment-1120</link>
		<dc:creator>Dylan Barrie</dc:creator>
		<pubDate>Thu, 20 May 2010 11:15:01 +0000</pubDate>
		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=263#comment-1120</guid>
		<description>You could simply declare the Obj-C object&#039;s instance vars in a C struct, and then use that C struct as-is.

typedef struct MyObjectStruct
{
    float phase;
    float frequencies;
} MyObjectStruct;

@interface MyObject : NSObject
{
    MyObjectStruct cStruct;
}

@end</description>
		<content:encoded><![CDATA[<p>You could simply declare the Obj-C object&#8217;s instance vars in a C struct, and then use that C struct as-is.</p>
<p>typedef struct MyObjectStruct<br />
{<br />
    float phase;<br />
    float frequencies;<br />
} MyObjectStruct;</p>
<p>@interface MyObject : NSObject<br />
{<br />
    MyObjectStruct cStruct;<br />
}</p>
<p>@end</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Helmut Taylor</title>
		<link>http://MacDeveloperTips.com/objective-c/objective-c-object-as-a-c-structure.html/comment-page-1#comment-1104</link>
		<dc:creator>Helmut Taylor</dc:creator>
		<pubDate>Sat, 01 May 2010 19:02:22 +0000</pubDate>
		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=263#comment-1104</guid>
		<description>Compiling this feature with iPhone 3.1.3 SDK 

typedef struct {	
	@defs(cwPlayer);
	//float phase;
	//float frequencies;
} *SinewaveDef;

If the target is a 3.1.3 Device and you are using the 3.1.3 SDK you will get a compile error

    @defs is no longer supported in new abi   

I am certain that some developer fixed this if they used this feature in their code
Any thoughts of what they used to hand stitch to access an
        objective C instance of a variables in a C-Style function
       float cwWave;
       SinewaveDef-&gt;phase;
       cwWave = 0.5 * sinf(def-&gt;phase);


thanks for any comment on this</description>
		<content:encoded><![CDATA[<p>Compiling this feature with iPhone 3.1.3 SDK </p>
<p>typedef struct {<br />
	@defs(cwPlayer);<br />
	//float phase;<br />
	//float frequencies;<br />
} *SinewaveDef;</p>
<p>If the target is a 3.1.3 Device and you are using the 3.1.3 SDK you will get a compile error</p>
<p>    @defs is no longer supported in new abi   </p>
<p>I am certain that some developer fixed this if they used this feature in their code<br />
Any thoughts of what they used to hand stitch to access an<br />
        objective C instance of a variables in a C-Style function<br />
       float cwWave;<br />
       SinewaveDef-&gt;phase;<br />
       cwWave = 0.5 * sinf(def-&gt;phase);</p>
<p>thanks for any comment on this</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob Muller</title>
		<link>http://MacDeveloperTips.com/objective-c/objective-c-object-as-a-c-structure.html/comment-page-1#comment-1020</link>
		<dc:creator>Bob Muller</dc:creator>
		<pubDate>Mon, 04 Jan 2010 19:23:28 +0000</pubDate>
		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=263#comment-1020</guid>
		<description>Thanks for that. But an object has instance variables -and- methods. How are the addresses of the methods represented in the struct? Is there a field in the struct that contains an address of a virtual dispatch table? 

And if TestClass had been a subclass of another class, say Foo, how would the inherited instance variables of Foo be laid out? Are they laid out directly in the struct bound to tmp or is there a pointer to a different struct containing the Foo instance variables?

Thanks for shedding light on this!

Bob Muller</description>
		<content:encoded><![CDATA[<p>Thanks for that. But an object has instance variables -and- methods. How are the addresses of the methods represented in the struct? Is there a field in the struct that contains an address of a virtual dispatch table? </p>
<p>And if TestClass had been a subclass of another class, say Foo, how would the inherited instance variables of Foo be laid out? Are they laid out directly in the struct bound to tmp or is there a pointer to a different struct containing the Foo instance variables?</p>
<p>Thanks for shedding light on this!</p>
<p>Bob Muller</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: p4bl0</title>
		<link>http://MacDeveloperTips.com/objective-c/objective-c-object-as-a-c-structure.html/comment-page-1#comment-672</link>
		<dc:creator>p4bl0</dc:creator>
		<pubDate>Mon, 02 Mar 2009 20:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://MacDeveloperTips.com/?p=263#comment-672</guid>
		<description>I don&#039;t know if this is useful but it&#039;s so cool 8-)</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know if this is useful but it&#8217;s so cool 8-)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
