<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Channel 9 Forums - Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Forums/rss"></atom:link>
	<image>
		<url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url>
		<title>Channel 9 Forums - Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<link>http://channel9.msdn.com/Forums</link>
	</image>
	<description>Channel 9 keeps you up to date with the latest news and behind the scenes info from Microsoft that developers love to keep up with. From LINQ to SilverLight – Watch videos and hear about all the cool technologies coming and the people behind them.</description>
	<link>http://channel9.msdn.com/Forums</link>
	<language>en</language>
	<pubDate>Sun, 19 May 2013 02:03:19 GMT</pubDate>
	<lastBuildDate>Sun, 19 May 2013 02:03:19 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<c9:totalResults>11</c9:totalResults>
	<c9:pageCount>-11</c9:pageCount>
	<c9:pageSize>-1</c9:pageSize>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p>So, I was researching Redhawk a little bit, and I found that its possible to call functions of WCL using C&#43;&#43;, like this:</p><p>it works, but I wonder when or how the GC kicks in, more research to do .... <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-4.gif?v=c9' alt='Tongue Out' /></p><p><img src="https://pbs.twimg.com/media/A9b4hJyCMAEqC-g.png:large" alt=""></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/22efa3a4076c4cbea6cea11f00e7e088#22efa3a4076c4cbea6cea11f00e7e088</link>
		<pubDate>Thu, 06 Dec 2012 14:04:14 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/22efa3a4076c4cbea6cea11f00e7e088#22efa3a4076c4cbea6cea11f00e7e088</guid>
		<dc:creator>felix9</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/felix9/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p>I'm not familiar with Redhawk but I assume you mean &quot;Reverse P/Invoke&quot;? If so, yes the .Net framework supports being called from C. Unfortunately this functionality is not plumbed all the way through to say, C#. Ideally there should be a &quot;DllExport&quot; attribute that allows a .Net assembly to have that method exported and be able to be called purely from C (while initializing the .Net framework during the 1st C call).</p><p>I needed this exact same functionality when I wrote some managed VST plugins. VST plugins are audio plugins for audio applications that uses a purely C interface. In my project, I created a DllExport attribute, and a post-build step would decompile to IL, then parses and sets the correct flags and does some other &quot;things&quot;, and then recompiles the IL. At that point those methods marked with DllExport shows up as C entry points. This works quite well, and the unmanaged audio applications can see and call into the managed DLL as if it was purely C/C&#43;&#43; code. The&nbsp;.Net runtime&nbsp;is fired up automatically as part of&nbsp;any initial C call into the DLL.</p><p>See <a href="http://social.msdn.microsoft.com/Forums/en-US/clr/thread/8648ff5e-c599-42e4-b873-6b91205a5c93/#dd7bd441-9897-448f-bb53-d458d13929e0">this thread </a>that contains a more detailed explanation and code for an early version of my parser. I feel it is a hack, and wish MS would just plumb this stuff all the way though, as it's 98% all there already.</p><p>If this was not what you were referring to, just ignore my post...</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/bad6ed9f11b44576908ca11f011695c5#bad6ed9f11b44576908ca11f011695c5</link>
		<pubDate>Thu, 06 Dec 2012 16:54:17 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/bad6ed9f11b44576908ca11f011695c5#bad6ed9f11b44576908ca11f011695c5</guid>
		<dc:creator>BitFlipper</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/BitFlipper/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/bad6ed9f11b44576908ca11f011695c5">57 minutes&nbsp;ago</a>, <a href="/Niners/BitFlipper">BitFlipper</a> wrote</p><p>I'm not familiar with Redhawk but I assume you mean &quot;Reverse P/Invoke&quot;? If so, yes the .Net framework supports being called from C. Unfortunately this functionality is not plumbed all the way through to say, C#. Ideally there should be a &quot;DllExport&quot; attribute that allows a .Net assembly to have that method exported and be able to be called purely from C (while initializing the .Net framework during the 1st C call).</p><p></p></div></blockquote><p></p><p>Just expose it as COM and be done with it <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-2.gif?v=c9' alt='Big Smile' /></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/445ac2ef5404428890eaa11f01267835#445ac2ef5404428890eaa11f01267835</link>
		<pubDate>Thu, 06 Dec 2012 17:52:07 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/445ac2ef5404428890eaa11f01267835#445ac2ef5404428890eaa11f01267835</guid>
		<dc:creator>blowdart</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/blowdart/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p>Exposing as COM is clearly not an option if what you are doing is creating an implementation for an established C interface, like VST for instance. How can COM possibly work in such a case?</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/cc322598374a47bfb830a11f012c48f6#cc322598374a47bfb830a11f012c48f6</link>
		<pubDate>Thu, 06 Dec 2012 18:13:18 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/cc322598374a47bfb830a11f012c48f6#cc322598374a47bfb830a11f012c48f6</guid>
		<dc:creator>BitFlipper</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/BitFlipper/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p>Actually, that is the problem with MS as well I think. They believe COM can fix use cases where you need this kind of interop when it clearly can't. Maybe this is why they don't bother fixing the last bit in the C# compiler and adding an attribute like DllExport to make it work without requiring COM.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/54f145a278404551bf6fa11f012de31c#54f145a278404551bf6fa11f012de31c</link>
		<pubDate>Thu, 06 Dec 2012 18:19:08 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/54f145a278404551bf6fa11f012de31c#54f145a278404551bf6fa11f012de31c</guid>
		<dc:creator>BitFlipper</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/BitFlipper/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/bad6ed9f11b44576908ca11f011695c5">1 hour&nbsp;ago</a>, <a href="/Niners/BitFlipper">BitFlipper</a> wrote</p><p>I'm not familiar with Redhawk but I assume you mean &quot;Reverse P/Invoke&quot;? If so, yes the .Net framework supports being called from C. Unfortunately this functionality is not plumbed all the way through to say, C#. Ideally there should be a &quot;DllExport&quot; attribute that allows a .Net assembly to have that method exported and be able to be called purely from C (while initializing the .Net framework during the 1st C call).</p><p>I needed this exact same functionality when I wrote some managed VST plugins. VST plugins are audio plugins for audio applications that uses a purely C interface. In my project, I created a DllExport attribute, and a post-build step would decompile to IL, then parses and sets the correct flags and does some other &quot;things&quot;, and then recompiles the IL. At that point those methods marked with DllExport shows up as C entry points. This works quite well, and the unmanaged audio applications can see and call into the managed DLL as if it was purely C/C&#43;&#43; code. The&nbsp;.Net runtime&nbsp;is fired up automatically as part of&nbsp;any initial C call into the DLL.</p><p>See <a href="http://social.msdn.microsoft.com/Forums/en-US/clr/thread/8648ff5e-c599-42e4-b873-6b91205a5c93/#dd7bd441-9897-448f-bb53-d458d13929e0">this thread </a>that contains a more detailed explanation and code for an early version of my parser. I feel it is a hack, and wish MS would just plumb this stuff all the way though, as it's 98% all there already.</p><p>If this was not what you were referring to, just ignore my post...</p><p></p></div></blockquote>you could use managed C&#43;&#43; as the interop layer, if &quot;VST&quot;&nbsp;extensibility&nbsp;works by loading a library and a bunch of functions, that'll be the easiest, for what it's worth you can call COM from C<p></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/715cab619c734d5e825ca11f0132be7f#715cab619c734d5e825ca11f0132be7f</link>
		<pubDate>Thu, 06 Dec 2012 18:36:49 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/715cab619c734d5e825ca11f0132be7f#715cab619c734d5e825ca11f0132be7f</guid>
		<dc:creator>Ion Todirel</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/Ion Todirel/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p>isn't VST based on some annoyingly almost-but-not-quite-COM convention?</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/923fe82b6ddb40c2ae30a11f0134bf0e#923fe82b6ddb40c2ae30a11f0134bf0e</link>
		<pubDate>Thu, 06 Dec 2012 18:44:06 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/923fe82b6ddb40c2ae30a11f0134bf0e#923fe82b6ddb40c2ae30a11f0134bf0e</guid>
		<dc:creator>contextfree`</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/contextfree`/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p>@<a href="/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C#c715cab619c734d5e825ca11f0132be7f">Ion Todirel</a>: I know you can call COM from C. The problem is not my lack of COM knowledge. The problem is if you try to create, say, a plugin that is supposed to adhere to a C API that does <strong>not</strong> use COM, then you can't use COM either. I guess no-one in MS ever considered such a use case. Just use COM!!!!</p><p>Also, the typical VST convention is to use a single DLL for the plugin, with no installer etc. This is because of the way VSTs are managed by audio applications, etc. When using the managed C&#43;&#43; approach, you end up with at least 2 DLLs. Functional but not ideal. My solution creates a single DLL solution (actually one for 32-bit and one for 64-bit during the post-compile step) that anyone can just copy into their VST folder, then let the audio application scan the VST folder, and it would find it thinking it uses the C VST API.</p><p>COM can't possibly enter into this picture. Why do people (and MS in general) still think COM can solve all these types of interop problems?</p><p>@<a href="/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C#c923fe82b6ddb40c2ae30a11f0134bf0e">contextfree`</a>: Maybe, but it is a cross-platform and very well established C API so there isn't even a chance they will ever make future versions use COM. MS had the &quot;DirectX&quot; COM-based plugin format many years ago, and there was a time when many Windows audio applications supported it. But VST is now the established API with almost no support for DirectX from plugin creators these days.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/9f122ff536f54bc58ce4a11f015ac6a1#9f122ff536f54bc58ce4a11f015ac6a1</link>
		<pubDate>Thu, 06 Dec 2012 21:02:34 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/9f122ff536f54bc58ce4a11f015ac6a1#9f122ff536f54bc58ce4a11f015ac6a1</guid>
		<dc:creator>BitFlipper</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/BitFlipper/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p></p><blockquote><div class="quoteText"><p></p><p><a class="permalink" title="Post Permalink" href="/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/bad6ed9f11b44576908ca11f011695c5">5 hours&nbsp;ago</a>, <a href="/Niners/BitFlipper">BitFlipper</a> wrote</p><p>I'm not familiar with Redhawk but I assume you mean &quot;Reverse P/Invoke&quot;? If so, yes the .Net framework supports being called from C. Unfortunately this functionality is not plumbed all the way through to say, C#. Ideally there should be a &quot;DllExport&quot; attribute that allows a .Net assembly to have that method exported and be able to be called purely from C (while initializing the .Net framework during the 1st C call).</p><p></p></div></blockquote><p></p><p>&nbsp;</p><p>This is a primer to the fabled 'Redhawk'&nbsp; ... its the future api of windows (or rather the base classes of windows)</p><p><a href="http://channel9.msdn.com/Forums/Coffeehouse/System-Language-Runtime-or-Project-Redhawk-surfaces-in-Windows-8">http://channel9.msdn.com/Forums/Coffeehouse/System-Language-Runtime-or-Project-Redhawk-surfaces-in-Windows-8</a></p><p>This is awesome stuff ... simply awesome!!!</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/475b66359cb14d78acd5a11f017225df#475b66359cb14d78acd5a11f017225df</link>
		<pubDate>Thu, 06 Dec 2012 22:27:40 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/475b66359cb14d78acd5a11f017225df#475b66359cb14d78acd5a11f017225df</guid>
		<dc:creator>LiquidBoy</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/LiquidBoy/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p>@<a href="/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C#cbad6ed9f11b44576908ca11f011695c5">BitFlipper</a>:</p><p>No, AFAICS, in Redhawk the whole framework is exposed as this way, and this is THE native way of calling methods, even if you are using C#.</p><p>Sure you have better language support as C# so you can do it more natually and properly, and with metadata in development time, but in the end you are calling other methods/assemblies as this, and your referenced assemblies are properly linked as implicitly imported DLLs, int the imports table, so Dependency Walker can see it. Also, all of the public methods in your assembly are exported as C functions as this.</p><p>But these function are not 'supposed' to be Reverse P/Invoke exports, they are actually Redhawk 'native' stuff, designed to be called from C#, so it suprised me that they are actually using native calling conventions and can actually be called from C&#43;&#43; and 'kinda' works. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-11.gif?v=c9' alt='Cool' /></p><p>Talking about Reverse P/Invoke, as Redhawk is supposed to unify the native and managed world, or at least much better interop, so yes, I can see there are also natual ways to do it in Redhawk.</p><p>One of the 2 user of Redawk in Win8 is whealogr.dll, and it is doing just that, and its exactly your scenario, as whealogr need to comply with the WDI 'plugin' interface, with is defined as C funtions like &quot;WdiDiagnosticModuleMain/WdiGetDiagnosticModuleInterfaceVersion/WdiHandleInstance&quot;, so whealogr exports these 3 C functions, and internally they are just C# static methods in a class, exported directly, they have a call to 'RhpReversePInvoke()' in the begining, and a call to 'RhpReversePInvokeReturn' in the end, so these are 'really' Reverse P/Invoke functions, it wont suprise me that I can call those in C&#43;&#43;. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-5.gif?v=c9' alt='Wink' /></p><p>plus: I noticed that there is an Attribute called System.Runtime.InteropServices.NativeCallableAttribute which MIGHT be related. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /></p><p>And, the other user of Redhawk is 'PowerWmiProvider.dll', and it exposes a COM interface, so I can see the team is using these 2 dlls to test the 2 main interop scenarios between Redhawk world and other parts of Windows.</p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/fe3bd096ff1f45dca354a12000241157#fe3bd096ff1f45dca354a12000241157</link>
		<pubDate>Fri, 07 Dec 2012 02:11:19 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/fe3bd096ff1f45dca354a12000241157#fe3bd096ff1f45dca354a12000241157</guid>
		<dc:creator>felix9</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/felix9/Discussions/RSS</wfw:commentRss>
	</item>
	<item>
		<title>Coffeehouse - Hacking Redhawk: Call Windows Class Libraries from C++</title>
		<description><![CDATA[<p>I can invoke a C&#43;&#43; lambda as a Redhawk Action, well, its not intended usage but its fun. <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /> </p><p><img src="https://pbs.twimg.com/media/A9h7AS4CEAAJ3KR.png:large" alt=""></p>]]></description>
		<link>http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/2f25ea46681041ecb2aca121010b2da1#2f25ea46681041ecb2aca121010b2da1</link>
		<pubDate>Sat, 08 Dec 2012 16:12:45 GMT</pubDate>
		<guid isPermaLink="false">http://channel9.msdn.com/Forums/Coffeehouse/Hacking-Redhawk-Call-Windows-Class-Libraries-from-C/2f25ea46681041ecb2aca121010b2da1#2f25ea46681041ecb2aca121010b2da1</guid>
		<dc:creator>felix9</dc:creator>
		<slash:comments>11</slash:comments>
		<wfw:commentRss>http://channel9.msdn.com/Niners/felix9/Discussions/RSS</wfw:commentRss>
	</item>
</channel>
</rss>