<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Reverse P/Invoke Marshaling Performance</title><link>http://blogs.msdn.com/junfeng/archive/2007/07/09/reverse-p-invoke-marshaling-performance.aspx</link><description>Platform Invoke allows managed code to call unmanaged functions exported by an DLL. While the reverse P/Invoke allows managed code to pass a managed delegate as a callback to native code. Both P/Invoke and Reverse P/Invoke requires parameter marshaling</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Reverse P/Invoke Marshaling Performance</title><link>http://blogs.msdn.com/junfeng/archive/2007/07/09/reverse-p-invoke-marshaling-performance.aspx#3784337</link><pubDate>Mon, 09 Jul 2007 21:16:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3784337</guid><dc:creator>DevDuck</dc:creator><description>&lt;p&gt;Can you explain why there is such a large difference?&lt;/p&gt;
</description></item><item><title>re: Reverse P/Invoke Marshaling Performance</title><link>http://blogs.msdn.com/junfeng/archive/2007/07/09/reverse-p-invoke-marshaling-performance.aspx#3798878</link><pubDate>Tue, 10 Jul 2007 17:04:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3798878</guid><dc:creator>Carlos</dc:creator><description>&lt;p&gt;Yeah, I wondered that.&lt;/p&gt;
&lt;p&gt;So I fired up .Net Reflector. &amp;nbsp;Marshal.PtrToStringUni allocates a StringBuilder, copies in the new string data, then allocates a new string from the StringBuilder. &amp;nbsp;In other words, it seems to be doing twice as much work as necessary. &amp;nbsp;(The further overhead may be extra GC work, but I'm speculating.)&lt;/p&gt;
&lt;p&gt;This should probably be filed as a performance bug.&lt;/p&gt;
</description></item></channel></rss>