<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Bit specific code in agnostic assemblies???</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450198.aspx</link><description>In previous blog entries I’ve spent some time talking about how to mark assemblies as bit specific and how the loader deals with those markings. What however is the preferred mode of an application? I will posit that it is to be compiled agnostic and</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Bit specific code in agnostic assemblies???</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450198.aspx#450422</link><pubDate>Thu, 11 Aug 2005 18:21:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450422</guid><dc:creator>Frank Hileman</dc:creator><description>This is useful information. If you use PInvoke, you are then &amp;quot;locked&amp;quot; into distributing 2 assemblies, and this technique won't work? There is no way around this?</description></item><item><title>re: Bit specific code in agnostic assemblies???</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450198.aspx#450424</link><pubDate>Thu, 11 Aug 2005 18:31:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450424</guid><dc:creator>joshwil</dc:creator><description>Using P/Invoke doesn't automatically lock you into 2 assemblies. For instance, P/Invoking to the Win32 API will work find as long as the signatures are correctly defined (i.e. things that scale are defined as IntPtr/UIntPtr and the structs don't have wierd packed layouts that can't be easily transitioned to 64-bit).&lt;br&gt;&lt;br&gt;Additionally if you are writing your own native code to P/Invoke to as long as you provide an interface that follows these conventions (and your dlls are named the same thing on both platforms, you may have to do some path magic to make this work) then everything will just work with an agnostic assembly.&lt;br&gt;&lt;br&gt;The problems crop up when you have something like a structure that has wierd packing that doesn't carry over to 64-bit or you have different interfaces on 32-bit and 64-bit. Even in this case as mentioned above if the functionality is the same and it is simple enough you could wrap the native call with a managed helper which knows (using the if(IntPtr.Size==8)/else trick) how to call the appropriate API depending on the platform and magically do the right thing (whatever that is) with arguments and return values.</description></item><item><title>re: Bit specific code in agnostic assemblies???</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450198.aspx#450980</link><pubDate>Fri, 12 Aug 2005 22:30:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450980</guid><dc:creator>Frank Hileman</dc:creator><description>Ok, I think I understand. I did do quite a bit of work porting from 32 to 64-bit processors in the past (alpha), so I understand the issues. It sounds like PInvoking to Win32 is not a problem, as long as we use the right signature.&lt;br&gt;&lt;br&gt;So let's consider that other case, PInvoking to our own unmanaged dlls -- and specifically what if you want one unmanaged build for both 32 and 64, is that an absurd idea? In the past I would think it would not even run... Maybe you have covered this before.&lt;br&gt;&lt;br&gt;Can you give an example of a structure with weird packing? I understand that if you assume pointers are the same size everything is messed up.</description></item><item><title>re: Bit specific code in agnostic assemblies???</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450198.aspx#450998</link><pubDate>Fri, 12 Aug 2005 23:14:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:450998</guid><dc:creator>joshwil</dc:creator><description>Frank --&lt;br&gt;&lt;br&gt;I'm not sure I understand the question. Are you asking if you can have a single unmanaged DLL and P/Invoke to it from managed code running under either the 32-bit or 64-bit runtimes?&lt;br&gt;&lt;br&gt;If that is the question then the answer is no. Given that your unmanaged code has to be either 32-bit or 64-bit and a process can only load DLLs of its native bitness then you won't be able to load your unmanaged DLL in one of the processes.&lt;br&gt;&lt;br&gt;I'll try to find an example of a structure that breaks on 64-bit, I don't have one at the ready (most don't).</description></item><item><title>Der managed P/Invoke Mediator</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450198.aspx#544124</link><pubDate>Mon, 06 Mar 2006 01:08:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:544124</guid><dc:creator>Dirk's Blog</dc:creator><description /></item><item><title>MDbg, Managed-debugging, and 64 bit</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450198.aspx#546264</link><pubDate>Wed, 08 Mar 2006 19:48:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:546264</guid><dc:creator>Mike Stall's .NET Debugging Blog</dc:creator><description>V2 CLR added support for 64-bit (amd64 and ia64), and that includes managed-debugging support. So a 64-bit...</description></item><item><title>Attorney Search &amp;raquo; Bit specific code in agnostic assemblies???</title><link>http://blogs.msdn.com/joshwil/archive/2005/08/10/450198.aspx#8412302</link><pubDate>Sun, 20 Apr 2008 20:35:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8412302</guid><dc:creator>Attorney Search &amp;raquo; Bit specific code in agnostic assemblies???</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://lawyers-for-injury.info/attorney-search/?p=280"&gt;http://lawyers-for-injury.info/attorney-search/?p=280&lt;/a&gt;&lt;/p&gt;
</description></item></channel></rss>