<?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: Interfacing Python with C using ctypes</title>
	<atom:link href="http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/</link>
	<description>In Pursuit of Truth</description>
	<lastBuildDate>Fri, 09 Apr 2010 10:27:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
	<item>
		<title>By: prashanthellina</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-32216</link>
		<dc:creator>prashanthellina</dc:creator>
		<pubDate>Mon, 10 Aug 2009 10:11:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-32216</guid>
		<description>If you need to return a char* from a c function and use that as a python string from python, you should do something like this,

&lt;pre lang=&quot;c&quot;&gt;
char* get_string()
{
    char* string = (char*) malloc(10);
    strcpy(string, &quot;bingo&quot;);
    return string
}
&lt;/pre&gt;
&lt;br/&gt;

from python:
&lt;pre lang=&quot;python&quot;&gt;
&gt;&gt;&gt; libtest.get_string.restype = c_char_p
&gt;&gt;&gt; libtest.get_string()
&#039;bingo&#039;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>If you need to return a char* from a c function and use that as a python string from python, you should do something like this,</p>
<pre lang="c">
char* get_string()
{
    char* string = (char*) malloc(10);
    strcpy(string, "bingo");
    return string
}
</pre>
<p></p>
<p>from python:</p>
<pre lang="python">
>>> libtest.get_string.restype = c_char_p
>>> libtest.get_string()
'bingo'
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Byzantine Reality &#187; Blog Archive &#187; Python’s ctypes package</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-5165</link>
		<dc:creator>Byzantine Reality &#187; Blog Archive &#187; Python’s ctypes package</dc:creator>
		<pubDate>Wed, 30 Jul 2008 17:38:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-5165</guid>
		<description>[...] need to replace the instance of “c-code.A.dylib” with “libtest.so.1.0″. So just like this tutorial showed me, we will call “LoadLibrary” (done later) to load your C functions which returns a [...]</description>
		<content:encoded><![CDATA[<p>[...] need to replace the instance of “c-code.A.dylib” with “libtest.so.1.0″. So just like this tutorial showed me, we will call “LoadLibrary” (done later) to load your C functions which returns a [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Byzantine Reality &#187; Blog Archive &#187; Python&#8217;s ctypes package</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-4862</link>
		<dc:creator>Byzantine Reality &#187; Blog Archive &#187; Python&#8217;s ctypes package</dc:creator>
		<pubDate>Tue, 22 Jul 2008 11:06:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-4862</guid>
		<description>[...] the instance of &#8220;c-code.A.dylib&#8221; with &#8220;libtest.so.1.0&#8243;. So just like this tutorial showed me, we will call &#8220;LoadLibrary&#8221; (done later) to load your C functions which [...]</description>
		<content:encoded><![CDATA[<p>[...] the instance of &#8220;c-code.A.dylib&#8221; with &#8220;libtest.so.1.0&#8243;. So just like this tutorial showed me, we will call &#8220;LoadLibrary&#8221; (done later) to load your C functions which [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Byzantine Reality &#187; Blog Archive &#187; Book of the Week: POSA Volume 2</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-4861</link>
		<dc:creator>Byzantine Reality &#187; Blog Archive &#187; Book of the Week: POSA Volume 2</dc:creator>
		<pubDate>Tue, 22 Jul 2008 11:04:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-4861</guid>
		<description>[...] not just a C++ book). It&#8217;s not like there aren&#8217;t other options, however, as SWIG and ctypes (latter is for Python only which we&#8217;ll talk more about on Friday) are specifically designed [...]</description>
		<content:encoded><![CDATA[<p>[...] not just a C++ book). It&#8217;s not like there aren&#8217;t other options, however, as SWIG and ctypes (latter is for Python only which we&#8217;ll talk more about on Friday) are specifically designed [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sharmila</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-1392</link>
		<dc:creator>Sharmila</dc:creator>
		<pubDate>Sat, 19 Jan 2008 18:00:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-1392</guid>
		<description>Superb! Will check this out.</description>
		<content:encoded><![CDATA[<p>Superb! Will check this out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: venkat</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-1274</link>
		<dc:creator>venkat</dc:creator>
		<pubDate>Tue, 08 Jan 2008 09:37:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-1274</guid>
		<description>wonderful. wonderful. thank you so much.</description>
		<content:encoded><![CDATA[<p>wonderful. wonderful. thank you so much.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prashanthellina</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-1273</link>
		<dc:creator>prashanthellina</dc:creator>
		<pubDate>Tue, 08 Jan 2008 07:04:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-1273</guid>
		<description>Here is good slide presentation I found about ctypes.
&lt;div style=&quot;width:425px;text-align:left&quot; id=&quot;__ss_22788&quot;&gt;&lt;object style=&quot;margin:0px&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://static.slideshare.net/swf/ssplayer2.swf?doc=c-types-extending-python-16931&quot;/&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;/&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot;/&gt;&lt;embed src=&quot;http://static.slideshare.net/swf/ssplayer2.swf?doc=c-types-extending-python-16931&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;355&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div style=&quot;font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;&quot;&gt;&lt;a href=&quot;http://www.slideshare.net/?src=embed&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://static.slideshare.net/swf/logo_embd.png&quot; style=&quot;border:0px none;margin-bottom:-5px&quot; alt=&quot;SlideShare&quot;/&gt;&lt;/a&gt; &#124; &lt;a href=&quot;http://www.slideshare.net/gnunify/c-types-extending-python&quot; title=&quot;View &#039;C Types - Extending Python&#039; on SlideShare&quot; rel=&quot;nofollow&quot;&gt;View&lt;/a&gt; &#124; &lt;a href=&quot;http://www.slideshare.net/upload&quot; rel=&quot;nofollow&quot;&gt;Upload your own&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;</description>
		<content:encoded><![CDATA[<p>Here is good slide presentation I found about ctypes.</p>
<div style="width:425px;text-align:left" id="__ss_22788"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=c-types-extending-python-16931"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=c-types-extending-python-16931" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"><a href="http://www.slideshare.net/?src=embed" rel="nofollow"><img src="http://static.slideshare.net/swf/logo_embd.png" style="border:0px none;margin-bottom:-5px" alt="SlideShare"/></a> | <a href="http://www.slideshare.net/gnunify/c-types-extending-python" title="View 'C Types - Extending Python' on SlideShare" rel="nofollow">View</a> | <a href="http://www.slideshare.net/upload" rel="nofollow">Upload your own</a></div>
</div>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sriram Krishnan</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-1271</link>
		<dc:creator>Sriram Krishnan</dc:creator>
		<pubDate>Tue, 08 Jan 2008 02:05:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-1271</guid>
		<description>Oops! Gotcha.</description>
		<content:encoded><![CDATA[<p>Oops! Gotcha.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: prashanthellina</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-1267</link>
		<dc:creator>prashanthellina</dc:creator>
		<pubDate>Tue, 08 Jan 2008 01:41:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-1267</guid>
		<description>Python takes 32 &lt;strong&gt;bytes&lt;/strong&gt;!</description>
		<content:encoded><![CDATA[<p>Python takes 32 <strong>bytes</strong>!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sriram Krishnan</title>
		<link>http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/comment-page-1/#comment-1263</link>
		<dc:creator>Sriram Krishnan</dc:creator>
		<pubDate>Mon, 07 Jan 2008 18:16:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.prashanthellina.com/2008/01/07/interfacing-python-with-c-using-ctypes/#comment-1263</guid>
		<description>I&#039;m unfamiliar with Python&#039;s implementation so this may seem naive. Why is it bad to use 32-bits to store a 32-bit integer? What am I missing here?</description>
		<content:encoded><![CDATA[<p>I&#8217;m unfamiliar with Python&#8217;s implementation so this may seem naive. Why is it bad to use 32-bits to store a 32-bit integer? What am I missing here?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
