<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Byetrix's Weblog</title>
	<atom:link href="http://byetrix.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://byetrix.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 21 Jul 2008 22:32:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='byetrix.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Byetrix's Weblog</title>
		<link>http://byetrix.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://byetrix.wordpress.com/osd.xml" title="Byetrix&#039;s Weblog" />
	<atom:link rel='hub' href='http://byetrix.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Thunk and its uses</title>
		<link>http://byetrix.wordpress.com/2008/07/21/thunk-and-its-uses/</link>
		<comments>http://byetrix.wordpress.com/2008/07/21/thunk-and-its-uses/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 22:32:10 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Software Research]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=28</guid>
		<description><![CDATA[Thunk and its uses<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=28&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.codeproject.com/KB/tips/Thunk.aspx">Thunk and its uses</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=28&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/07/21/thunk-and-its-uses/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Use member functions for C-style callbacks and threads &#8211; a general solution</title>
		<link>http://byetrix.wordpress.com/2008/07/21/use-member-functions-for-c-style-callbacks-and-threads-a-general-solution/</link>
		<comments>http://byetrix.wordpress.com/2008/07/21/use-member-functions-for-c-style-callbacks-and-threads-a-general-solution/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 22:19:51 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Software Research]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=26</guid>
		<description><![CDATA[Use member functions for C-style callbacks and threads &#8211; a general solution<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=26&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.codeproject.com/KB/winsdk/callback_adapter.aspx">Use member functions for C-style callbacks and threads &#8211; a general solution</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/26/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/26/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=26&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/07/21/use-member-functions-for-c-style-callbacks-and-threads-a-general-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Prevent User Access to Windows Desktop</title>
		<link>http://byetrix.wordpress.com/2008/07/21/prevent-user-access-to-windows-desktop/</link>
		<comments>http://byetrix.wordpress.com/2008/07/21/prevent-user-access-to-windows-desktop/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 21:54:02 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Software Research]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=24</guid>
		<description><![CDATA[Prevent User Access to Windows Desktop<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=24&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.codeproject.com/KB/winsdk/AntonioWinLock.aspx">Prevent User Access to Windows Desktop</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=24&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/07/21/prevent-user-access-to-windows-desktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Herb Sutter&#8217;s Article on Hand-Over-Hand Locking</title>
		<link>http://byetrix.wordpress.com/2008/07/21/herb-sutters-article-on-hand-over-hand-locking/</link>
		<comments>http://byetrix.wordpress.com/2008/07/21/herb-sutters-article-on-hand-over-hand-locking/#comments</comments>
		<pubDate>Mon, 21 Jul 2008 21:52:06 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Software Research]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=22</guid>
		<description><![CDATA[Herb Sutter&#8217;s article on hand-over-hand locking<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=22&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ddj.com/hpc-high-performance-computing/208801371;jsessionid=0YPCVHP0FJV0OQSNDLPSKHSCJUNN2JVN">Herb Sutter&#8217;s article on hand-over-hand locking</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=22&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/07/21/herb-sutters-article-on-hand-over-hand-locking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Using Proxy Functions to Call User-Defined Functions</title>
		<link>http://byetrix.wordpress.com/2008/06/15/using-dynamic-delegates-to-speed-up-calling-callback-functions/</link>
		<comments>http://byetrix.wordpress.com/2008/06/15/using-dynamic-delegates-to-speed-up-calling-callback-functions/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 05:14:46 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Software Research]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=20</guid>
		<description><![CDATA[I was working on a project framework which needed to give our users a way to code callback functions in a .Net language of their choice.  What seemed like the best approach was to have our users develop their callback functions as .Net delegates, then we could have our framework call the callabcks using Delegate.Invoke.  Although doing [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=20&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was working on a project framework which needed to give our users a way to code callback functions in a .Net language of their choice.  What seemed like the best approach was to have our users develop their callback functions as .Net delegates, then we could have our framework call the callabcks using Delegate.Invoke.  Although doing so works and is easy to code, it placed a requirement on our framework users.  They would need to define a delegate signature in order use our framework to invoke the functions they created.  We wanted a way for people using our framework to create callback functions of any signature without requiring that they create delegate signatures.  To address that, we came up with a callback mechanism we called a ProxyFunction, which uses the Reflection.Emit.DynamicMethod lightweight code generation introduced in the .Net 2.0 framework.  ProxyFunction acts as an interception proxy, accepting the parameters intended for a target callback function, building a call stack from those parameters, calling the callback function and returning the callback function results to the client code.  Our framework bound an instance of ProxyFunction to its associated callback function when our users registered the callbacks. </p>
<p>DynamicMethod is lighter weight than the original Reflection.Emit because you don&#8217;t need to define an assembly, module, or type.  Basically, you create a static delegate definition dynamically, then bind the dynamically-created delegate to whatever class you want.  One interesting aspect of DynamicMethod is that the memory used to define an instance of the DynamicMethod class is eleigible for garbage collection. </p>
<p>The design goals we had in mind for ProxyFunction (listed here in no particular order) were:</p>
<ul>
<li>Calling a callback function could not be significantly slower than calling Delegate.Invoke.</li>
<li>Our users needed to be able to create callback functions of any signature they chose.
<ul>
<li>This includes static, virtual and generic methods.</li>
</ul>
</li>
<li>Callback functions can be either just a function or the implementation of a delegate.</li>
<li>If the callback function contains either out or ref parameters, the framework needs to propagate the potentially-changed parameter values back to the client code.</li>
</ul>
<p>Essentially, the way a DynamicMethod works is that you create a delegate type definition that sets the signature for a function you implement by generating IL code.  To accommodate the requirements we list above, the DynamicMethod signature we settled on was:</p>
<p>public delegate object ProxyFunction(object targetClass, object[] args);</p>
<p>The return type is object, so our users can supply whatever return type they want, including void.  targetClass is an instance of the class that houses our user-supplied callback function.  If the callback function is static, we don&#8217;t use targetClass in building the DynamicMethod.  &#8216;args&#8217; is an object array, where each element in the array represents one parameter the target function needs.  The args array maps its elements to target function parameters top-to-bottom, left-to-right.</p>
<p>We also considered using the following delegate type definition:</p>
<p>public delegate object ProxyFunction(object[] args);</p>
<p>with the intent to use args[0] as an instance of the class housing the user-defined callback.  However, we thought it would make the intent of specifying a defining type versus the parameters to a callback function more explicit by having the delegate definition include both concepts individually.</p>
<p>Now that we know what our ProxyFunction signature will be, let&#8217;s take a look at the class that implements the capability to dynamically build a call stack and call framework callback functions.  Our class contains only one function, defined like this:</p>
<p>public static ProxyFunction Create(MethodInfo methodInfo)</p>
<p>Given a reference to the MethodInfo class associated with the callback function we want to invoke, this function creates and returns a ProxyFunction.  We&#8217;ll demonstrate a couple different ways to obtain the callback function&#8217;s MethodInfo data when we illustrate using this class.</p>
<p>The first thing to do is to create the parameter signatures our DynamicMethod will use.  It is important to point out the distinction between parameters passed to the DynamicMethod definition and those passed to the callback we want to invoke.  Here are the parameter definitions:</p>
<p>Type[] <span style="font-size:x-small;">proxyFunctionArgTypes</span> = { typeof(object), typeof(object[]) };</p>
<p>What this statement does is tell the DynamicMethod we will create shortly that it will accept parameters of the same signature we defined in the ProxyFunction delegate definition statement.  This is important, because the matching signatures give us a known type we can instantiate from framework code.</p>
<p>We next create the DynamicMethod:</p>
<pre>bool skipVisibilityChecks = true;
DynamicMethod dynamicMethod =
    new DynamicMethod("",                     // we don't give the DynamicMethod a name
        typeof(object),                       // DynamicMethod's return type
        proxyFunctionArgTypes,                // DynamicMethod's arguments
        typeof(ProxyFunctionFactory),         // The class which we will bind DynamicMethod to
        skipVisibilityChecks);</pre>
<p>We can associate a DynamicMethod, which we recall is an instance of a static function, to pretty much any class we want.  But, since we can&#8217;t know in advance what classes our users may create, we&#8217;ll bind the DynamicMethod to the class which defines our factory function: ProxyFunctionFactory.  Doing so brings up the need to allow us to invoke callback functions that will exist in classes other than ProxyFunctionFactory.  If we want to invoke those callbacks which would otherwise be unavailable to our factory function due to the callbacks&#8217; visibility (protected, private, internal, etc.), we need to set a flag that tells the DynamicMethod we want to call those callbacks even though we wouldn&#8217;t normally be able to.  We communicate this by setting the value of the skipVisibilityChecks parameter to true.</p>
<p>OK, now that we have a DynamicMethod, we need to associate a function body with it.  We do so by getting the Intermediate Language (IL) code generator associated with the DynamicMethod.  Think of IL as a simplified assembly language that you can feed to the .Net runtime to create a new function on the fly.  The .Net runtime will take that assembly and turn it into machine code when it (the runtime) first tries to do anything with the IL.  IL is surprisingly easy to use, all the more so because all we&#8217;re going to do is build a call stack and call a function.  To get an instance of the IL generator, you do something like this:</p>
<p>ILGenerator il = dynamicMethod.GetILGenerator();</p>
<p>Now we have the context with which we can construct our DynamicMethod body.  The first thing we&#8217;ll do is to check that the number of parameters passed to our DynamicMethod matches the number of parameters our target callback function expects.  Remember that what we&#8217;re doing is using the DynamicMethod to call a user-defined function, so the parameters passed to the DynamicMethod in the object[] array get passed through to the target callback.  We implement this check by creating a label (which basically marks an IL instruction as a branch target), put in some code that checks the numbers of arguments we have and throws an exception if the numbers of arguments don&#8217;t match, then concludes by creating a branch instruction where the branch target is one instruction beyond our throw statement.  So, if the number of parameters supplied to our DynamicMethod matches the number of parameters the callback function expects, we branch past the throw statement.  We define the branch label like this (bearing in mind that this just defines the branch label; it doesn&#8217;t associate the branch label with a target IL instruction):</p>
<p>Label numArgsTheSameLabel = il.DefineLabel();</p>
<p>IL is a stack-based language.  To do things you push arguments onto the stack using some form of &#8220;load&#8221; instruction then push an instruction onto the stack.  When control enters the IL you generate, the instruction will pop the arguments off the stack and potentially push a result onto the stack when the instruction completes.  You use some form of &#8220;store&#8221; instruction to pull a value off the stack and put the value into a location in the function body.</p>
<p>With this in mind, we begin the section that checks the number of parameters by pushing a reference to our target parameter array onto the stack.  Recall that the second argument to the interception proxy is an array of object[] having as many elements as our target callback function has parameters, as we defined earlier using the statement &#8220;Type[] ProxyFunctionArgTypes = { typeof(object), typeof(object[]) }&#8221;.  The way we push our argument array onto the stack looks like this:</p>
<p>il.Emit(OpCodes.Ldarg_1)</p>
<p>The Ldarg opcode has a number of specialized shortcuts defining commonly-performed operations to take the place of a more verbose sequence of instructions.  Ldarg_1 tells .Net to put the 2nd parameter to the ProxyFunctionFactory.Create function on the stack.  Parameters are numbered starting at zero.</p>
<p>We then push an instruction that will pop our array reference off the stack then push the array length onto the stack.  The instruction looks like this:</p>
<p>il.Emit(OpCodes.Ldlen);</p>
<p>So, what we&#8217;ve done is to look at the arguments array provided in the interception proxy parameter type definition and place onto the stack the number of elements in that array.  Next, we&#8217;ll figure out how many arguments our callback function expects.  That&#8217;s where the &#8216;methodInfo&#8217; parameter to the ProxyFunctionFactory.Create method comes in.  Recall that we use the Create method from our framework to dynamically generate the interception proxy function.  The MethodInfo instance refers to the user-supplied callback function the interception proxy will call.  We calculate the number of parameters our callback function using code like this:</p>
<pre>ParameterInfo[] targetFunctionParms = methodInfo.GetParameters();
int numTargetParms = targetFunctionParms.Length;</pre>
<p>So, what we have on the IL stack now is the length of our interception proxy parameter array.  We&#8217;ll push the number of parameters our callback function takes by pushing onto the stack the value of &#8220;numTargetParms&#8221; as integer constant, like this:</p>
<p>il.Emit(OpCodes.Ldc_I4, numTargetParms);</p>
<p>With these 2 values on the stack, we&#8217;ll create a branch instruction to compare the 2 stack values and, if they&#8217;re equal, branch to a point in the interception proxy definition identified with the &#8220;numArgsTheSameLabel&#8221; label we defined above:</p>
<p>il.Emit(OpCodes.Beq, numArgsTheSameLabel);</p>
<p>If the opcode condition, in this case being &#8220;branch if equal&#8221;, evaluates to false, .Net will just keep processing instructions in the order listed in the IL code.  So, directly following the branch instruction are two IL instructions that construct an instance of an exception and then throw that exception:</p>
<pre>il.Emit(OpCodes.Newobj, typeof(TargetParameterCountException).GetConstructor(Type.EmptyTypes));
il.Emit(OpCodes.Throw);</pre>
<p>Now we&#8217;ll place our branch target label one instruction beyond the throw:</p>
<p>il.MarkLabel(numArgsTheSameLabel);</p>
<p>So, what we did was to push the interception proxy array reference on the stack, push the opcode to evaluate the array length, push the number of parameters the callback function expects, then push a branch instruction that will branch around the exception creation and throw if the parameter array length and number of callback function arguments match.</p>
<p>We&#8217;re now ready to construct a call stack and call our target function.  If the target function is not static, we need to push a reference to an instance of the class that conatins the target function.  Recall that the first argument to our ProxyFunctionFactory.Create function is a reference to the class instance containing our target function, so pushing the target object on the stack looks like this:</p>
<pre>if (!methodInfo.IsStatic)
{
    // The dynamic method's argument 0 is the instance of a class
    // containing our target function.
    il.Emit(OpCodes.Ldarg_0);
}</pre>
<p>The next thing to do is extact from the DynamicMethod&#8217;s object[] array argument the parameters the target function will need.  One thing to account for is the need to copy back to the DynamicMethod object[] array any ref or out parameters the target function may change.  As an example, let&#8217;s say our target function looks like this:</p>
<p>string F7(int a, ref string b)</p>
<p>The target function may change the value of &#8216;b&#8217;, so we will need to arrange to copy back into the args array the updated value of &#8216;b&#8217;.  The way we arrange for this is to define, in the body of our DynamicMethod, as many local variables as there are ref or out parameters in the target function.  We&#8217;ll keep a dictionary that maps the position of the ref or out parameter to the DynamicMethod&#8217;s declaration of the corresponding local variable.  After we call the target function, we&#8217;ll copy the contents of the dictionary back to the DynamicMethod&#8217;s arg array.  We&#8217;ll define our dictionary like this:</p>
<pre>Dictionary&lt;int, LocalBuilder&gt; referenceValueMap = new Dictionary&lt;int, LocalBuilder&gt;();</pre>
<p>
LocalBuilder is a class, defined in the Relection.Emit namespace, used to declare local variables in IL code.
</p>
<p> </p>
<p>
It&#8217;s probably better to explain the next section by showing the code first, then going through it in detail.  Basically, what we&#8217;re doing is extracting from the DynamicMethod&#8217;s args array the parameters our target function will need.
</p>
<pre>
            <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; numTargetParms; i++)
            {
                <span class="rem">// The proxy funcion signature has the class containing the target function</span>
                <span class="rem">// as its first argument.  The 2nd argument is an array of object holding the</span>
                <span class="rem">// target function arguments.</span>
                <span class="rem">// Push the argument array onto the stack.</span>
                il.Emit(OpCodes.Ldarg_1);

                <span class="rem">// Push the argument index onto the stack.</span>
                il.Emit(OpCodes.Ldc_I4, i);

                <span class="rem">// Load the argument array object at index i onto the stack</span>
                il.Emit(OpCodes.Ldelem_Ref);

                Type parameterType = targetFunctionParms[i].ParameterType;
                <span class="kwrd">if</span> (parameterType.IsByRef)
                {
                    parameterType = parameterType.GetElementType();
                    <span class="kwrd">if</span> (parameterType.IsValueType)
                    {
                        <span class="rem">// Turn the object into a primitive type</span>
                        il.Emit(OpCodes.Unbox, parameterType);
                    }
                    <span class="kwrd">else</span>
                    {
                        <span class="rem">// If the target function has arguments passed by reference, we create a local variable </span>
                        <span class="rem">// that will hold the address of the variable to be passed to the target function.  We </span>
                        <span class="rem">// put the local variable in a map, so we can put the local variable value back in the </span>
                        <span class="rem">// argument array after we call the target delegate function, which may have chaged</span>
                        <span class="rem">// the reference parameter value.</span>
                        LocalBuilder localVar = il.DeclareLocal(parameterType);
                        referenceValueMap.Add(i, localVar);

                        <span class="rem">// Store the argument value in a local variable</span>
                        il.Emit(OpCodes.Stloc, localVar);

                        <span class="rem">// Push the local variable address onto the stack</span>
                        il.Emit(OpCodes.Ldloca, localVar);
                    }
                }
                <span class="kwrd">else</span>
                {
                    <span class="kwrd">if</span> (parameterType.IsValueType)
                    {
                        <span class="rem">// Turn the object into aprimitive type</span>
                        il.Emit(OpCodes.Unbox, parameterType);

                        <span class="rem">// Replace the object reference with its value</span>
                        il.Emit(OpCodes.Ldobj, parameterType);
                    }
                }
            }
</pre>
<p>
For each parameter in args, we load a reference to args onto the stack, load a constant that indexes into the args array onto the stack, then pull the actual parameter out of the args array using the opcode:
</p>
<p>
il.Emit(OpCodes.Ldelem_Ref);
</p>
<p>
OK, so we now have the parameter on the stack as an object reference.  We need to be able to set things up to handle ref and out parameters.  There are 2 cases to consider: first, where the parameter is a primitive or value type, such as an int; and second, where the parameter is a class type.  If the parameter is a primitive type, all you need to do is &#8216;unbox&#8217; the object reference that is on the stack.  &#8216;Unboxing&#8217; means that we remove all the wrappings .Net puts around a primitive type to make the type take on all the attributes needed for variables of type object to have the fundamental capabilities needed for printing its value, etc.  Once pushed onto the stack in its native type, the target function can change the value, and the updated value will be reflected in the DynamicMethod&#8217;s args array.
</p>
<p>
In the case where the ref or out parameter is a class type, we need to create a local variable, add it to the dictionary, store the parameter into the local variable, then push the local variable onto the stack.
</p>
<p>
If the parameter is neither a ref nor out parameter, all we need to do is examine it to see if it of a primitive type.  If it is, we need to unbox it and push the raw parameter value onto the stack.
</p>
<p>
Now that we have the parameters on the stack, it&#8217;s time to call our target function.  There are 2 basic ways to call a function in IL (actually, there are 3, but one of them is rarely used).  If a fuinction&#8217;s definition allows it to be overridden, the opcode to use is:
</p>
<pre>il.Emit(OpCodes.Callvirt, methodInfo);</pre>
<p>
otherwise the correct opcode is:
</p>
<pre>il.Emit(OpCodes.Call, methodInfo);</pre>
<p>
After we call the target function, we need to copy any changed ref or out parameters that are of class type back to the calling context, where the calling context is defined as the DynamicMethod args array.  Doing so looks like this:
</p>
<pre>
            <span class="rem">// Copy any changed reference values back into the argument array.</span>
            <span class="kwrd">foreach</span> (KeyValuePair&lt;<span class="kwrd">int</span>, LocalBuilder&gt; kvp <span class="kwrd">in</span> referenceValueMap)
            {
                <span class="rem">// Push the argument array onto the stack</span>
                il.Emit(OpCodes.Ldarg_1);

                <span class="rem">// Push the argument array index onto the stack</span>
                il.Emit(OpCodes.Ldc_I4, kvp.Key);

                <span class="rem">// Push the possibly-changed local variable value onto the stack</span>
                il.Emit(OpCodes.Ldloc, kvp.Value);

                <span class="rem">// Store the local value in the argument array, so that the changed</span>
                <span class="rem">// value is available to the calling context.</span>
                il.Emit(OpCodes.Stelem_Ref);
            }</pre>
<p>
We&#8217;ve called our target function, so now we need to put its return value on the stack.  Recall that our DynamicMethod signature has the return type declared as type object.  If the target function return type is void, we load a null as the DynamicMethod return value, by doing this:
</p>
<pre>il.Emit(OpCodes.Ldnull);</pre>
<p>
If the return value is a primitive type, we need to box it.  Boxing a primitive type wraps all the information necessary for the .Net runtime to work with the value type as it would with any other type that derives from System.Object.  This boxing allows for things like serializing the primitive type&#8217;s value in a uniform way.</p>
<pre>il.Emit(OpCodes.Box, methodInfo.ReturnType);</pre>
<p>
We finish the DynamicMethod body by generating the &#8216;return&#8217; opcode, like this:
</p>
<pre>il.Emit(OpCodes.Ret);</pre>
<p>
What remains to be done is to create the DynamicMethod delegate object we can call directly.  Doing so seals the DynamicMethod, making it ineligible for further modification.  We create the delegate like this:
</p>
<pre>return (ProxyFunction)dynamicMethod.CreateDelegate(typeof(ProxyFunction));</pre>
<p>
That&#8217;s it for creaing the proxy function.  In this next section we&#8217;ll demonstrate using the proxy.  When a customer uses our framework to set up their functions to be used as callbacks, we use .Net reflection to build the MethodInfo class needed to construct a ProxyFunction.  Doing so is relatively straight forward, but we do need to take into account the fact that a user may declare generic functions or use functions in generic types.
</p>
<p>
In the simple case, where we just have a non-generic function, we can manufacture the required MethodInfo class instance by doing something like this:
</p>
<pre>
        <span class="kwrd">double</span> F6(<span class="kwrd">int</span> a, <span class="kwrd">ref</span> <span class="kwrd">double</span> b)
        {
            Console.WriteLine(<span class="str">"F6"</span>);

            <span class="kwrd">double</span> result = a + b;

            b = a;

            <span class="kwrd">return</span> result;
        }

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F6"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            <span class="kwrd">double</span> dblArg = 4.0;
            <span class="kwrd">object</span>[] targetArgs = <span class="kwrd">new</span> <span class="kwrd">object</span>[] { 3, dblArg };
            <span class="kwrd">double</span> dblReturn = (<span class="kwrd">double</span>)proxy(p, targetArgs);
</pre>
<p>
Where the &#8216;F6&#8242; function is declared in a simple test harness class named (quite imaginatively) Program.  Once created, we can call the proxy as we would any other function.
</p>
<p>
Our Program class defines one generic method.  Constructing the MethodInfo instance we need is a 2 step process: first we need the definition for the generic method itself; then we need a MethodInfo representing the data-type-specific concrete instance of the generic function&#8217;s definition.  Stated another way, we get the MethodInfo for the generic type before specifying the generic&#8217;s type, then we need to qualify the generic with the data type that makes the generic take on a particular data type.  Here&#8217;s how we do that:
</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre>
        <span class="kwrd">int</span> F11&lt;T&gt;(<span class="kwrd">int</span> a, <span class="kwrd">out</span> T b, <span class="kwrd">string</span> c, <span class="kwrd">ref</span> <span class="kwrd">double</span> d) <span class="kwrd">where</span> T : <span class="kwrd">new</span>()
        {
            Console.WriteLine(<span class="str">"F11"</span>);

            T e = <span class="kwrd">new</span> T();
            b = e;
            d = 1.23;
            <span class="kwrd">return</span> a;
        }

            MethodInfo genericMi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F11"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            mi = genericMi.MakeGenericMethod(<span class="kwrd">new</span> Type[] { <span class="kwrd">typeof</span>(<span class="kwrd">double</span>) } );
            proxy = ProxyFunctionFactory.Create(mi);
            intArg = 3;
            dblArg = 3.45;
            stringArg = <span class="str">"Ick"</span>;
            <span class="kwrd">double</span> dblArg2 = 6.78;
            targetArgs = <span class="kwrd">new</span> <span class="kwrd">object</span>[] { intArg, dblArg, stringArg, dblArg2 };
            intReturn = (<span class="kwrd">int</span>)proxy(p, targetArgs);</pre>
<p>
The call to &#8216;MakeGenericMethod&#8217; tells the generic method that its one generic parameter will become concrete as data type double.
</p>
<p>
So, there you have it.  The remainder of this post is the code for the ProxyFunction class and its associated factory and a small class used to test the ProxyFunction class.
</p>
<hr />
<p><!-- code formatted by http://manoli.net/csharpformat/ --></p>
<pre>
<span class="rem">//////////////////////////////////////////////////////////////////////</span>
<span class="rem">// This file implements a class that lets us dynamically construct</span>
<span class="rem">// a static function whose signature is general enough that we can</span>
<span class="rem">// use the dynamic function as a proxy that can call any other</span>
<span class="rem">// function we want.  We use this capability so that we can marshal</span>
<span class="rem">// functions' signatures to a client that wants to be able to call</span>
<span class="rem">// functions in a server without rquiring the server to create</span>
<span class="rem">// a delegate signature or service contract for each callback</span>
<span class="rem">// function.</span>
<span class="rem">//////////////////////////////////////////////////////////////////////</span>

<span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Reflection;
<span class="kwrd">using</span> System.Reflection.Emit;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">using</span> System.Text;

<span class="kwrd">namespace</span> ProxyGen
{
    <span class="rem">/// &lt;summary&gt;</span>
    <span class="rem">/// Define a type whose signature allows us to call an exisitng function we want to be able to call</span>
    <span class="rem">/// dynamically.</span>
    <span class="rem">/// &lt;/summary&gt;</span>
    <span class="rem">/// &lt;param name="target"&gt;The data type that contains the callback function we want to call.&lt;/param&gt;</span>
    <span class="rem">/// &lt;param name="args"&gt;An array of data type object that are the values we will call the</span>
    <span class="rem">/// user-defined callback with.&lt;/param&gt;</span>
    <span class="rem">/// &lt;returns&gt;Data type object whose contained value is of the same type as the original instrument</span>
    <span class="rem">/// action method, which may be null.&lt;/returns&gt;</span>
    <span class="kwrd">public</span> <span class="kwrd">delegate</span> <span class="kwrd">object</span> ProxyFunction(<span class="kwrd">object</span> targetClass, <span class="kwrd">object</span>[] args);

    <span class="rem">/// &lt;summary&gt;</span>
    <span class="rem">/// A class that generates a ProxyFunction given an instance of  a MethodInfo</span>
    <span class="rem">/// class.  We examine the MethodInfo instance and construct from it a ProxyFunction</span>
    <span class="rem">/// we can call dynamically.</span>
    <span class="rem">/// &lt;/summary&gt;</span>
    <span class="kwrd">class</span> ProxyFunctionFactory
    {
        <span class="rem">/// &lt;summary&gt;</span>
        <span class="rem">/// Generates a ProxyFunction given an instance of a MethodInfo</span>
        <span class="rem">/// class.</span>
        <span class="rem">/// &lt;/summary&gt;</span>
        <span class="rem">/// &lt;param name="method"&gt;An instance of the MethodInfo class representing the</span>
        <span class="rem">/// instrument action we want to call.&lt;/param&gt;</span>
        <span class="rem">/// &lt;returns&gt;An instance of the ProxyFunction we can call dynamically.&lt;/returns&gt;</span>
        <span class="kwrd">public</span> <span class="kwrd">static</span> ProxyFunction Create(MethodInfo methodInfo)
        {
            <span class="rem">// The arguments we send to the dynamic method are the target object instance</span>
            <span class="rem">// containing the target callback function we want to call and an array</span>
            <span class="rem">// of type object, where each element in the object in the array is one</span>
            <span class="rem">// argument to the target function.</span>
            Type[] proxyFunctionArgTypes = { <span class="kwrd">typeof</span>(<span class="kwrd">object</span>), <span class="kwrd">typeof</span>(<span class="kwrd">object</span>[]) };

            <span class="rem">// Create dynamic method and obtain its IL generator to</span>
            <span class="rem">// inject code.  </span>
            <span class="rem">// We set skipVisibilityChecks true because the target callback</span>
            <span class="rem">// function may be in a class we would not usually have access to.</span>
            <span class="kwrd">bool</span> skipVisibilityChecks = <span class="kwrd">true</span>;
            DynamicMethod dynamicMethod =
                <span class="kwrd">new</span> DynamicMethod(<span class="str">""</span>,                   <span class="rem">// we don't give the DynamicMethod a name</span>
                <span class="kwrd">typeof</span>(<span class="kwrd">object</span>),                         <span class="rem">// DynamicMethod's return type</span>
                proxyFunctionArgTypes,                  <span class="rem">// DynamicMethod's arguments</span>
                <span class="kwrd">typeof</span>(ProxyFunctionFactory),           <span class="rem">// The class which we will bind DynamicMethod to</span>
                skipVisibilityChecks);
            ILGenerator il = dynamicMethod.GetILGenerator();

            <span class="preproc">#region</span> Generate IL <span class="kwrd">for</span> proxy function

            <span class="preproc">#region</span> Check proxy arg count against target arg count

            <span class="rem">// Define a label for succesful argument count checking.</span>
            Label numArgsTheSameLabel = il.DefineLabel();

            <span class="rem">// Check the number of arguments sent to the proxy function.</span>
            <span class="rem">// Push the proxy function argument array onto the stack.</span>
            il.Emit(OpCodes.Ldarg_1);

            <span class="rem">// Get the proxy function argument array length</span>
            il.Emit(OpCodes.Ldlen);

            <span class="rem">// Get the number of arguments defined in the target function.</span>
            ParameterInfo[] targetFunctionParms = methodInfo.GetParameters();
            <span class="kwrd">int</span> numTargetParms = targetFunctionParms.Length;

            <span class="rem">// Push numTargetParms onto the stack as an int constant</span>
            il.Emit(OpCodes.Ldc_I4, numTargetParms);

            <span class="rem">// If the number of arguments in the object array matches the number</span>
            <span class="rem">// of arguments the target function expects, we're golden, branch around</span>
            <span class="rem">// the next section of code to where we set the argsOK label.</span>
            il.Emit(OpCodes.Beq, numArgsTheSameLabel);

            <span class="rem">// Argument count was wrong, throw TargetParameterCountException.</span>
            il.Emit(OpCodes.Newobj,
                <span class="kwrd">typeof</span>(TargetParameterCountException).GetConstructor(Type.EmptyTypes));
            il.Emit(OpCodes.Throw);

            <span class="rem">// Set the branch target, identifying the statement where we will pick</span>
            <span class="rem">// up if the number of arguments in the target function match the number</span>
            <span class="rem">// of arguments sent to the dynamic method.</span>
            il.MarkLabel(numArgsTheSameLabel);

            <span class="preproc">#endregion</span>

            <span class="preproc">#region</span> Push target function containing <span class="kwrd">object</span>

            <span class="rem">// If method isn't static push target instance on top</span>
            <span class="rem">// of stack.</span>
            <span class="kwrd">if</span> (!methodInfo.IsStatic)
            {
                <span class="rem">// The dynamic method's argument 0 is the instance of a class</span>
                <span class="rem">// containing our target function.</span>
                il.Emit(OpCodes.Ldarg_0);
            }

            <span class="preproc">#endregion</span>

            <span class="preproc">#region</span> Push proxy function parameters onto stack 

            <span class="rem">// If the target function has arguments passed by reference, we create a local variable </span>
            <span class="rem">// that will hold the address of the variable to be passed to the target function.  We </span>
            <span class="rem">// put the local variable in a map, so we can put the local variable value back in the </span>
            <span class="rem">// argument array after we call the target delegate function, which may have chaged</span>
            <span class="rem">// the reference parameter value.</span>
            Dictionary&lt;<span class="kwrd">int</span>, LocalBuilder&gt; referenceValueMap = <span class="kwrd">new</span> Dictionary&lt;<span class="kwrd">int</span>, LocalBuilder&gt;();

            <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; numTargetParms; i++)
            {
                <span class="rem">// The proxy funcion signature has the class containing the target function</span>
                <span class="rem">// as its first argument.  The 2nd argument is an array of object holding the</span>
                <span class="rem">// target function arguments.</span>
                <span class="rem">// Push the argument array onto the stack.</span>
                il.Emit(OpCodes.Ldarg_1);

                <span class="rem">// Push the argument index onto the stack.</span>
                il.Emit(OpCodes.Ldc_I4, i);

                <span class="rem">// Load the argument array object at index i onto the stack</span>
                il.Emit(OpCodes.Ldelem_Ref);

                Type parameterType = targetFunctionParms[i].ParameterType;
                <span class="kwrd">if</span> (parameterType.IsByRef)
                {
                    parameterType = parameterType.GetElementType();
                    <span class="kwrd">if</span> (parameterType.IsValueType)
                    {
                        <span class="rem">// Turn the object into a primitive type</span>
                        il.Emit(OpCodes.Unbox, parameterType);
                    }
                    <span class="kwrd">else</span>
                    {
                        <span class="rem">// If the target function has arguments passed by reference, we create a local variable </span>
                        <span class="rem">// that will hold the address of the variable to be passed to the target function.  We </span>
                        <span class="rem">// put the local variable in a map, so we can put the local variable value back in the </span>
                        <span class="rem">// argument array after we call the target delegate function, which may have chaged</span>
                        <span class="rem">// the reference parameter value.</span>
                        LocalBuilder localVar = il.DeclareLocal(parameterType);
                        referenceValueMap.Add(i, localVar);

                        <span class="rem">// Store the argument value in a local variable</span>
                        il.Emit(OpCodes.Stloc, localVar);

                        <span class="rem">// Push the local variable address onto the stack</span>
                        il.Emit(OpCodes.Ldloca, localVar);
                    }
                }
                <span class="kwrd">else</span>
                {
                    <span class="kwrd">if</span> (parameterType.IsValueType)
                    {
                        <span class="rem">// Turn the object into a primitive type</span>
                        il.Emit(OpCodes.Unbox, parameterType);

                        <span class="rem">// Replace the object reference with its value</span>
                        il.Emit(OpCodes.Ldobj, parameterType);
                    }
                }
            }

            <span class="preproc">#endregion</span>

            <span class="preproc">#region</span> Call the target function

            <span class="rem">// If the target function is final (cannot be overridden)</span>
            <span class="rem">// use the Call opcode, otherwise use Callvirt</span>
            <span class="kwrd">if</span> (methodInfo.IsFinal)
            {
                il.Emit(OpCodes.Call, methodInfo);
            }
            <span class="kwrd">else</span>
            {
                il.Emit(OpCodes.Callvirt, methodInfo);
            }

            <span class="rem">// Copy any changed reference values back into the argument array.</span>
            <span class="kwrd">foreach</span> (KeyValuePair&lt;<span class="kwrd">int</span>, LocalBuilder&gt; kvp <span class="kwrd">in</span> referenceValueMap)
            {
                <span class="rem">// Push the argument array onto the stack</span>
                il.Emit(OpCodes.Ldarg_1);

                <span class="rem">// Push the argument array index onto the stack</span>
                il.Emit(OpCodes.Ldc_I4, kvp.Key);

                <span class="rem">// Push the possibly-changed local variable value onto the stack</span>
                il.Emit(OpCodes.Ldloc, kvp.Value);

                <span class="rem">// Store the local value in the argument array, so that the changed</span>
                <span class="rem">// value is available to the calling context.</span>
                il.Emit(OpCodes.Stelem_Ref);
            }

            <span class="kwrd">if</span> (methodInfo.ReturnType == <span class="kwrd">typeof</span>(<span class="kwrd">void</span>))
            {
                il.Emit(OpCodes.Ldnull);
            }
            <span class="kwrd">else</span>
            {
                <span class="rem">// If the result is a value type, it needs to be boxed, as opposed to pushing</span>
                <span class="rem">// an object reference to it onto the stack.</span>
                <span class="kwrd">if</span> (methodInfo.ReturnType.IsValueType)
                {
                    il.Emit(OpCodes.Box, methodInfo.ReturnType);
                }
            }

            <span class="rem">// Return from the proxy function</span>
            il.Emit(OpCodes.Ret);

            <span class="preproc">#endregion</span>

            <span class="preproc">#endregion</span>

            <span class="kwrd">return</span> (ProxyFunction)dynamicMethod.CreateDelegate(<span class="kwrd">typeof</span>(ProxyFunction));
        }
    }
}
<hr />

<span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Reflection;

<span class="kwrd">namespace</span> ProxyGen
{
    <span class="kwrd">class</span> Program
    {
        <span class="preproc">#region</span> Test Functions

        <span class="kwrd">static</span> <span class="kwrd">void</span> F1()
        {
            Console.WriteLine(<span class="str">"F1"</span>);
        }

        <span class="kwrd">void</span> F2()
        {
            Console.WriteLine(<span class="str">"F2"</span>);
        }

        <span class="kwrd">static</span> <span class="kwrd">int</span> F3()
        {
            Console.WriteLine(<span class="str">"F3"</span>);
            <span class="kwrd">return</span> 1;
        }

        <span class="kwrd">int</span> F4()
        {
            Console.WriteLine(<span class="str">"F4"</span>);
            <span class="kwrd">return</span> 2;
        }

        <span class="kwrd">int</span> F5(<span class="kwrd">int</span> a)
        {
            Console.WriteLine(<span class="str">"F5"</span>);
            <span class="kwrd">return</span> ++a;
        }

        <span class="kwrd">double</span> F6(<span class="kwrd">int</span> a, <span class="kwrd">ref</span> <span class="kwrd">double</span> b)
        {
            Console.WriteLine(<span class="str">"F6"</span>);

            <span class="kwrd">double</span> result = a + b;

            b = a;

            <span class="kwrd">return</span> result;
        }

        <span class="kwrd">string</span> F7(<span class="kwrd">int</span> a, <span class="kwrd">ref</span> <span class="kwrd">string</span> b)
        {
            Console.WriteLine(<span class="str">"F7"</span>);

            <span class="kwrd">string</span> result = b + a.ToString();

            b = a.ToString();

            <span class="kwrd">return</span> result;
        }

        <span class="kwrd">double</span>[] F8(<span class="kwrd">int</span> numArrayElements, <span class="kwrd">double</span> initialValue)
        {
            Console.WriteLine(<span class="str">"F8"</span>);

            <span class="kwrd">double</span>[] result = <span class="kwrd">new</span> <span class="kwrd">double</span>[numArrayElements];

            <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; numArrayElements; ++i)
            {
                result[i] = initialValue;
            }

            <span class="kwrd">return</span> result;
        }

        <span class="kwrd">string</span>[] F9(<span class="kwrd">int</span> numArrayElements, <span class="kwrd">double</span> initialValue)
        {
            Console.WriteLine(<span class="str">"F9"</span>);

            <span class="kwrd">double</span>[] dblArray = F8(numArrayElements, initialValue);

            <span class="kwrd">string</span>[] result = <span class="kwrd">new</span> <span class="kwrd">string</span>[dblArray.Length];

            <span class="kwrd">for</span> (<span class="kwrd">int</span> i = 0; i &lt; dblArray.Length; ++i)
            {
                result[i] = (dblArray[i] * i).ToString();
            }

            <span class="kwrd">return</span> result;
        }

        <span class="kwrd">void</span> F10(<span class="kwrd">out</span> <span class="kwrd">string</span>[] a)
        {
            Console.WriteLine(<span class="str">"F10"</span>);
            <span class="kwrd">string</span>[] b = <span class="kwrd">new</span> <span class="kwrd">string</span>[] { <span class="str">"Moe"</span>, <span class="str">"Larry"</span>, <span class="str">"Curly"</span> };
            a = b;
        }

        <span class="kwrd">delegate</span> <span class="kwrd">int</span> GenericDelegate&lt;T&gt;(<span class="kwrd">int</span> a, <span class="kwrd">out</span> T b, <span class="kwrd">string</span> c, <span class="kwrd">ref</span> <span class="kwrd">double</span> d) <span class="kwrd">where</span> T : <span class="kwrd">new</span>();

        <span class="kwrd">int</span> F11&lt;T&gt;(<span class="kwrd">int</span> a, <span class="kwrd">out</span> T b, <span class="kwrd">string</span> c, <span class="kwrd">ref</span> <span class="kwrd">double</span> d) <span class="kwrd">where</span> T : <span class="kwrd">new</span>()
        {
            Console.WriteLine(<span class="str">"F11"</span>);

            T e = <span class="kwrd">new</span> T();
            b = e;
            d = 1.23;
            <span class="kwrd">return</span> a;
        }

        <span class="preproc">#endregion</span>

        <span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args)
        {
            Program p = <span class="kwrd">new</span> Program();

            MethodInfo mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F1"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public| BindingFlags.Static);
            ProxyFunction proxy = ProxyFunctionFactory.Create(mi);
            proxy(p, <span class="kwrd">new</span> <span class="kwrd">object</span>[] {});

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F2"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            proxy(p, <span class="kwrd">new</span> <span class="kwrd">object</span>[] { });

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F3"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            <span class="kwrd">int</span> intReturn = (<span class="kwrd">int</span>)proxy(p, <span class="kwrd">new</span> <span class="kwrd">object</span>[] { });

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F4"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            intReturn = (<span class="kwrd">int</span>)proxy(p, <span class="kwrd">new</span> <span class="kwrd">object</span>[] { });

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F5"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            intReturn = (<span class="kwrd">int</span>)proxy(p, <span class="kwrd">new</span> <span class="kwrd">object</span>[] { 3 } );

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F6"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            <span class="kwrd">double</span> dblArg = 4.0;
            <span class="kwrd">object</span>[] targetArgs = <span class="kwrd">new</span> <span class="kwrd">object</span>[] { 3, dblArg };
            <span class="kwrd">double</span> dblReturn = (<span class="kwrd">double</span>)proxy(p, targetArgs);

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F7"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            <span class="kwrd">int</span> intArg = 4;
            <span class="kwrd">string</span> stringArg = <span class="str">"Yo!"</span>;
            targetArgs = <span class="kwrd">new</span> <span class="kwrd">object</span>[] { intArg, stringArg };
            <span class="kwrd">string</span> stringResult = (<span class="kwrd">string</span>)proxy(p, targetArgs);

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F8"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            intArg = 4;
            <span class="kwrd">double</span> initVal = 3.14;
            targetArgs = <span class="kwrd">new</span> <span class="kwrd">object</span>[] { intArg, initVal };
            <span class="kwrd">double</span>[] dblArrayResult = (<span class="kwrd">double</span>[])proxy(p, targetArgs);

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F9"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            intArg = 4;
            initVal = 3.14;
            targetArgs = <span class="kwrd">new</span> <span class="kwrd">object</span>[] { intArg, initVal };
            <span class="kwrd">string</span>[] stringArrayResult = (<span class="kwrd">string</span>[])proxy(p, targetArgs);

            mi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F10"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            proxy = ProxyFunctionFactory.Create(mi);
            <span class="kwrd">string</span>[] stringArrayArg = <span class="kwrd">new</span> <span class="kwrd">string</span>[] { };
            targetArgs = <span class="kwrd">new</span> <span class="kwrd">object</span>[] { stringArrayArg };
            proxy(p, targetArgs);

            MethodInfo genericMi = <span class="kwrd">typeof</span>(Program).GetMethod(<span class="str">"F11"</span>, BindingFlags.Instance |
                BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static);
            mi = genericMi.MakeGenericMethod(<span class="kwrd">new</span> Type[] { <span class="kwrd">typeof</span>(<span class="kwrd">double</span>) } );
            proxy = ProxyFunctionFactory.Create(mi);
            intArg = 3;
            dblArg = 3.45;
            stringArg = <span class="str">"Ick"</span>;
            <span class="kwrd">double</span> dblArg2 = 6.78;
            targetArgs = <span class="kwrd">new</span> <span class="kwrd">object</span>[] { intArg, dblArg, stringArg, dblArg2 };
            intReturn = (<span class="kwrd">int</span>)proxy(p, targetArgs);

            <span class="rem">// This is intentionally intended to fail to test out the argument-</span>
            <span class="rem">// checking part of the proxy function generation</span>
            <span class="kwrd">try</span>
            {
                intReturn = (<span class="kwrd">int</span>)proxy(p, <span class="kwrd">new</span> <span class="kwrd">object</span>[] { });
            }
            <span class="kwrd">catch</span> (TargetParameterCountException e)
            {
                Console.WriteLine(<span class="str">"Correctly caught exception:{0}{1}"</span>,
                    Environment.NewLine, e.Message);
            }
        }
    }
}
</pre>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/20/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/20/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=20&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/06/15/using-dynamic-delegates-to-speed-up-calling-callback-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Syntax highlighting wit Qt</title>
		<link>http://byetrix.wordpress.com/2008/06/04/syntax-highlighting-wit-qt/</link>
		<comments>http://byetrix.wordpress.com/2008/06/04/syntax-highlighting-wit-qt/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 17:03:23 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Software Research]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=19</guid>
		<description><![CDATA[Syntax highlighting with Qt<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=19&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://doc.trolltech.com/qq/qq21-syntaxhighlighter.html">Syntax highlighting with Qt</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=19&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/06/04/syntax-highlighting-wit-qt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Instantiating Generic Types at Runtime</title>
		<link>http://byetrix.wordpress.com/2008/05/04/instantiating-generic-types-at-runtime/</link>
		<comments>http://byetrix.wordpress.com/2008/05/04/instantiating-generic-types-at-runtime/#comments</comments>
		<pubDate>Sun, 04 May 2008 21:47:08 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=18</guid>
		<description><![CDATA[Instantiating Generic Types at Runtime<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=18&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://todotnet.com/archive/2006/11/13/10788.aspx">Instantiating Generic Types at Runtime</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/18/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/18/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=18&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/05/04/instantiating-generic-types-at-runtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Integrate a programming language into Visual Studio 2005</title>
		<link>http://byetrix.wordpress.com/2008/05/04/integrate-a-programming-language-into-visual-studio-2005/</link>
		<comments>http://byetrix.wordpress.com/2008/05/04/integrate-a-programming-language-into-visual-studio-2005/#comments</comments>
		<pubDate>Sun, 04 May 2008 21:45:09 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=17</guid>
		<description><![CDATA[Integrate a programming language into Visual Studio 2005<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=17&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.bitwisemag.com/copy/features/dev/visual_studio/vs2005_integration_1.html">Integrate a programming language into Visual Studio 2005</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/17/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/17/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=17&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/05/04/integrate-a-programming-language-into-visual-studio-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
		<item>
		<title>Managed Language Service</title>
		<link>http://byetrix.wordpress.com/2008/05/04/managed-language-service/</link>
		<comments>http://byetrix.wordpress.com/2008/05/04/managed-language-service/#comments</comments>
		<pubDate>Sun, 04 May 2008 21:43:13 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=16</guid>
		<description><![CDATA[Managed Language Service<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=16&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/bb166360(VS.80).aspx">Managed Language Service</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=16&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/05/04/managed-language-service/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
		<item>
		<title>.Net Interop Directional Marshaling</title>
		<link>http://byetrix.wordpress.com/2008/05/04/net-interop-directional-marshaling/</link>
		<comments>http://byetrix.wordpress.com/2008/05/04/net-interop-directional-marshaling/#comments</comments>
		<pubDate>Sun, 04 May 2008 20:51:50 +0000</pubDate>
		<dc:creator>byetrix</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://byetrix.wordpress.com/?p=15</guid>
		<description><![CDATA[.Net Interop Directional Marshaling<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=15&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/magazine/cc164193.aspx">.Net Interop Directional Marshaling</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/byetrix.wordpress.com/15/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/byetrix.wordpress.com/15/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/byetrix.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/byetrix.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/byetrix.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/byetrix.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/byetrix.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/byetrix.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/byetrix.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/byetrix.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/byetrix.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/byetrix.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/byetrix.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/byetrix.wordpress.com/15/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/byetrix.wordpress.com/15/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/byetrix.wordpress.com/15/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=byetrix.wordpress.com&amp;blog=2887624&amp;post=15&amp;subd=byetrix&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://byetrix.wordpress.com/2008/05/04/net-interop-directional-marshaling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/08230bee295a0be6f3375d5f802ffaac?s=96&#38;d=identicon" medium="image">
			<media:title type="html">byetrix</media:title>
		</media:content>
	</item>
	</channel>
</rss>
