<?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/"
	>

<channel>
	<title>dipplum.com &#187; win32</title>
	<atom:link href="http://dipplum.com/tag/win32/feed/" rel="self" type="application/rss+xml" />
	<link>http://dipplum.com</link>
	<description>Be  the change you wanna see in the world</description>
	<lastBuildDate>Sat, 12 Nov 2011 07:38:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Visual C++ 2008编译libpng</title>
		<link>http://dipplum.com/2009/11/09/visualc-compile-libpng/</link>
		<comments>http://dipplum.com/2009/11/09/visualc-compile-libpng/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 05:23:39 +0000</pubDate>
		<dc:creator>li</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[libpng]]></category>
		<category><![CDATA[visualc]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[zlib]]></category>

		<guid isPermaLink="false">http://dipplum.com/2009/11/09/visualc-compile-libpng/</guid>
		<description><![CDATA[1. 主页 http://www.libpng.org/pub/png/libpng.html 2. 最新稳定版本 1.2.40 &#160;&#160;&#160; 源码下载 http://download.sourceforge.net/libpng/lpng1240.zip 3. 编译依赖 &#160;&#160;&#160; 依赖zlib。要求名为zlib的目录位于和libpng源码平级的目录下。libpng会自行编译zlib的源码，而zlib 1.2.3版本中的汇编代码在VC 2008下编译存在问题，参见zlib的编译说明。 4. 编译方法 &#160;&#160;&#160; 打开源码中的projects\vc71\libpng.sln工程文件。编译DLL ASM Release和LIB ASM Release就可以了。会得到libpng.lib、libpng13.lib、libpng13.dll。 5. 注意 &#160;&#160;&#160; ligpng会编译自己的zlib1.dll和zlib.lib，不知道编译参数和zlib自己的工程文件是否一样，也不知道和zlib工程文件编译出的dll和lib会不会冲突。这个问题留待考察。]]></description>
			<content:encoded><![CDATA[<p>1. 主页 <a href="http://www.libpng.org/pub/png/libpng.html">http://www.libpng.org/pub/png/libpng.html</a></p>
<p>2. 最新稳定版本 1.2.40</p>
<p>&#160;&#160;&#160; 源码下载 <a href="http://download.sourceforge.net/libpng/lpng1240.zip">http://download.sourceforge.net/libpng/lpng1240.zip</a></p>
<p>3. 编译依赖</p>
<p>&#160;&#160;&#160; 依赖zlib。要求名为zlib的目录位于和libpng源码平级的目录下。libpng会自行编译zlib的源码，而zlib 1.2.3版本中的汇编代码在VC 2008下编译存在问题，参见<a href="http://dipplum.com/2009/11/08/visualc-compile-zlib/" target="_blank">zlib的编译说明</a>。</p>
<p>4. 编译方法</p>
<p>&#160;&#160;&#160; 打开源码中的projects\vc71\libpng.sln工程文件。编译DLL ASM Release和LIB ASM Release就可以了。会得到libpng.lib、libpng13.lib、libpng13.dll。</p>
<p>5. 注意</p>
<p>&#160;&#160;&#160; ligpng会编译自己的zlib1.dll和zlib.lib，不知道编译参数和zlib自己的工程文件是否一样，也不知道和zlib工程文件编译出的dll和lib会不会冲突。这个问题留待考察。</p>
]]></content:encoded>
			<wfw:commentRss>http://dipplum.com/2009/11/09/visualc-compile-libpng/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Side-by-Side Assembly相关</title>
		<link>http://dipplum.com/2009/11/09/side-by-side-assembly/</link>
		<comments>http://dipplum.com/2009/11/09/side-by-side-assembly/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 04:10:11 +0000</pubDate>
		<dc:creator>li</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[side-by-side]]></category>
		<category><![CDATA[sxs]]></category>
		<category><![CDATA[win32]]></category>

		<guid isPermaLink="false">http://dipplum.com/2009/11/09/side-by-side-assembly/</guid>
		<description><![CDATA[什么是Side-by-Side Assembly？ Side-by-Side Assembly（建称SxS）是微软在Visual Studio 2005（Windows 2000？）中引入的技术，用来解决Windows平台上的DLL Hell问题。DLL Hell的介绍可以看Wikipedia的文章。简单的说，DLL Hell窘境包括了Windows应用程序依赖的DLL带来的若干问题，包括同名DLL、DLL升级、DLL载入顺序等等。 Side-by-Side Assembly按照我的理解，是一种特殊的DLL，按照Side-by-Side Assembly的要求开发的，并用XML格式的manifest和policy文件描述的。所有的系统Side-by-Side Assembly都安装在Windows目录下的WinSxS子目录里，有一堆的目录、DLL和XML文件。 Side-by-Side Assembly的使用参见MSDN。但MSDN有把简单问题复杂化的毛病，原理讲的很多，实际例子举的很少，不看也罢。 使用Side-by-Side Assembly包括两个方面，一方面是自己开发的应用程序和DLL如何依赖Side-by-Side Assembly，另一方面是如何开发自己的Side-by-Side Assembly。如果只关心第一个方面，问题要简单的多。不需要关心第二个方面的原因如下。 Visual Studio 2010要取消对Side-by-Side Assembly的默认支持？ 消息来源于微软的博客，根据文章介绍，2010要改变对应用默认采用的SxS发布方式，回到类似2003的方式，同时支持对CRT的静态和动态联编，对DLL的搜索顺序也是常用的：先搜索应用程序目录，然后System32，然后PATH。 当然SxS还是有的，应该只是Visual Studio不再在开发应用时默认采用。 应用如何依赖Side-by-Side Assembly cl.exe在链接生成EXE的时候，会同时生成一个同名的manifest文件。该文件是XML格式的，描述了EXE对SxS的依赖。下面是一个manifest的例子： &#60;?xml version=&#34;2.0&#34; encoding=&#34;UTF-8&#34; standalone=&#34;yes&#34;?&#62; &#60;assembly xmlns=&#34;urn:schemas-microsoft-com:asm.v1&#34; manifestversion=&#34;1.0&#34;&#62; &#60;trustinfo xmlns=&#34;urn:schemas-microsoft-com:asm.v3&#34;&#62; &#60;security&#62; &#60;requestedprivileges&#62; &#60;requestedexecutionlevel uiaccess=&#34;false&#34; level=&#34;asInvoker&#34;&#62;&#60;/requestedexecutionlevel&#62; &#60;/requestedprivileges&#62; &#60;/security&#62; &#60;/trustinfo&#62; &#60;dependency&#62; &#60;dependentassembly&#62; &#60;assemblyidentity name=&#34;Microsoft.VC90.CRT&#34; publickeytoken=&#34;1fc8b3b9a1e18e3b&#34; processorarchitecture=&#34;x86&#34; version=&#34;9.0.21022.8&#34; type=&#34;win32&#34;&#62;&#60;/assemblyidentity&#62; [...]]]></description>
			<content:encoded><![CDATA[<h4>什么是Side-by-Side Assembly？</h4>
<p>Side-by-Side Assembly（建称SxS）是微软在Visual Studio 2005（Windows 2000？）中引入的技术，用来解决Windows平台上的DLL Hell问题。DLL Hell的介绍可以看<a href="http://en.wikipedia.org/wiki/DLL_hell" target="_blank">Wikipedia的文章</a>。简单的说，DLL Hell窘境包括了Windows应用程序依赖的DLL带来的若干问题，包括同名DLL、DLL升级、DLL载入顺序等等。</p>
<p>Side-by-Side Assembly按照我的理解，是一种特殊的DLL，按照Side-by-Side Assembly的要求开发的，并用XML格式的manifest和policy文件描述的。所有的系统Side-by-Side Assembly都安装在Windows目录下的WinSxS子目录里，有一堆的目录、DLL和XML文件。</p>
<p>Side-by-Side Assembly的使用<a href="http://msdn.microsoft.com/en-us/library/aa376307%28VS.85%29.aspx" target="_blank">参见MSDN</a>。但MSDN有把简单问题复杂化的毛病，原理讲的很多，实际例子举的很少，不看也罢。</p>
<p>使用Side-by-Side Assembly包括两个方面，一方面是自己开发的应用程序和DLL如何依赖Side-by-Side Assembly，另一方面是如何开发自己的Side-by-Side Assembly。如果只关心第一个方面，问题要简单的多。不需要关心第二个方面的原因如下。</p>
<h4></h4>
<p> <span id="more-420"></span><br />
<h4>Visual Studio 2010要取消对Side-by-Side Assembly的默认支持？</h4>
<p>消息来源于<a href="http://blogs.msdn.com/vcblog/archive/2008/10/28/visual-studio-2010-ctp-released.aspx" target="_blank">微软的博客</a>，根据文章介绍，2010要改变对应用默认采用的SxS发布方式，回到类似2003的方式，同时支持对CRT的静态和动态联编，对DLL的搜索顺序也是常用的：先搜索应用程序目录，然后System32，然后PATH。</p>
<p>当然SxS还是有的，应该只是Visual Studio不再在开发应用时默认采用。</p>
<h4>应用如何依赖Side-by-Side Assembly</h4>
<p>cl.exe在链接生成EXE的时候，会同时生成一个同名的manifest文件。该文件是XML格式的，描述了EXE对SxS的依赖。下面是一个manifest的例子：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;2.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span> <span style="color: #000066;">standalone</span>=<span style="color: #ff0000;">&quot;yes&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;assembly</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;urn:schemas-microsoft-com:asm.v1&quot;</span> <span style="color: #000066;">manifestversion</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;trustinfo</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;urn:schemas-microsoft-com:asm.v3&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;requestedprivileges<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;requestedexecutionlevel</span> <span style="color: #000066;">uiaccess</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">level</span>=<span style="color: #ff0000;">&quot;asInvoker&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/requestedexecutionlevel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/requestedprivileges<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/security<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/trustinfo<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;dependentassembly<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;assemblyidentity</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Microsoft.VC90.CRT&quot;</span> <span style="color: #000066;">publickeytoken</span>=<span style="color: #ff0000;">&quot;1fc8b3b9a1e18e3b&quot;</span> <span style="color: #000066;">processorarchitecture</span>=<span style="color: #ff0000;">&quot;x86&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;9.0.21022.8&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;win32&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/assemblyidentity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependentassembly<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/dependency<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/assembly<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>如果删除这个manifest文件，运行该EXE会出现类似下面的错误：</p>
<p><a href="http://dipplum.com/files/2009/11/manifesterror.png" rel="shadowbox[sbpost-420];player=img;"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="manifest-error" border="0" alt="manifest-error" src="http://dipplum.com/files/2009/11/manifesterror_thumb.png" width="421" height="149" /></a> </p>
<p>这是因为缺少manifest文件的描述，程序不知道如何载入WinSxS目录下的DLL。所以最好把manifest文件嵌入EXE中，可以用mt.exe工具完成这一工作：</p>

<div class="wp_syntax"><div class="code"><pre class="batch" style="font-family:monospace;">mt.exe -manifest &lt;manifest-file&gt; -outputresource:&lt;exe-file&gt;;#1</pre></div></div>

<p>用IDE开发不存在这个问题，IDE会自动调用mt.exe将manifest嵌入EXE</p>
<h4>DLL如何依赖Side-by-Side Assembly</h4>
<p>同上述原因，DLL生成之后，最好也用mt.exe将manifest文件嵌入。方法与上面类似，不同之处在资源ID应该是2而不是1，其中的区别参见<a href="http://blogs.msdn.com/junfeng/archive/2007/06/26/rt-manifest-resource-and-isolation-aware-enabled.aspx" target="_blank">【1】</a><a href="http://blogs.msdn.com/zakramer/archive/2006/05/22/603558.aspx" target="_blank">【2】</a>，硬记也行，没什么道理。</p>

<div class="wp_syntax"><div class="code"><pre class="batch" style="font-family:monospace;">mt.exe -manifest &lt;manifest-file&gt; -outputresource:&lt;dll-file&gt;;#2</pre></div></div>

<p>用IDE开发也不存在这个问题，IDE会自动调用mt.exe将manifest嵌入DLL</p>
<h4>如何绕过Side-by-Side Assembly？</h4>
<p>Side-by-Side Assembly带来了很多不便，比如说，依赖SxS MSVCR90.dll的程序在没有安装VC redistributable的系统中不能运行，像是WinPE环境。因此最好有一种绕过SxS的方法，将SxS的Assembly和EXE放在一个目录下，避免依赖系统WinSxS目录下的Assembly。</p>
<p>1. 首先，我们需要manifest文件，如果手头没有EXE和DLL的manifest文件，可以用mt.exe工具从EXE和DLL中导出manifest文件</p>
<p>导出EXE的manifest</p>

<div class="wp_syntax"><div class="code"><pre class="batch" style="font-family:monospace;">mt.exe -inputresource:&lt;exe-file&gt;;#1 -out:&lt;manifest-file&gt;</pre></div></div>

<p>导出DLL的manifest</p>

<div class="wp_syntax"><div class="code"><pre class="batch" style="font-family:monospace;">mt.exe -outputresource:&lt;dll-file&gt;;#2 -out:&lt;manifest-file&gt;</pre></div></div>

<p>2. 根据manifest中的信息，创建若干新的manifest文件。新manifest文件名和EXE中依赖的Assembly名字对应，例如按照前面的manifest例子，应该对应创建一个Microsoft.VC90.CRT.manifest，内容格式如下：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;2.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span> <span style="color: #000066;">standalone</span>=<span style="color: #ff0000;">&quot;yes&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;assembly</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;urn:schemas-microsoft-com:asm.v1&quot;</span> <span style="color: #000066;">manifestversion</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;noinheritable<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/noinheritable<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;assemblyidentity</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Microsoft.VC90.CRT&quot;</span> <span style="color: #000066;">publickeytoken</span>=<span style="color: #ff0000;">&quot;1fc8b3b9a1e18e3b&quot;</span> <span style="color: #000066;">processorarchitecture</span>=<span style="color: #ff0000;">&quot;x86&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;9.0.21022.8&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;win32&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/assemblyidentity<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;msvcr90.dll&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;msvcp90.dll&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/assembly<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>其中assemblyIdentity和原EXE的内容要完全一样。</p>
<p>3. 根据manifest文件中的assemblyIdentity信息，到系统的WinSxS目录下的子目录里找DLL，子目录名的格式是&lt;processorArchchitecture&gt;-&lt;name&gt;-&lt;publicKeyToken&gt;-&lt;version&gt;-none-xxx。把子目录下的DLL拷贝到EXE所在的目录下。把DLL的名字写入新manifest的file标签下。</p>
<p>至此，已经把Assembly放到EXE所在目录下，EXE也不再依赖系统WinSxS目录下的Assembly了。</p>
<h4>VC 2005和VC 2008相关的SxS打包</h4>
<p>我把自己系统中WinSxS目录下所有x86_micosoft.vc开头的目录全部拷贝出来，打了个包，以备不时之需。（<a href="http://www.uploadground.com/files/07MZXBUU/Microsoft.VCXX.SxS.zip" target="_blank">下载链接</a>）</p>
]]></content:encoded>
			<wfw:commentRss>http://dipplum.com/2009/11/09/side-by-side-assembly/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Visual C++ 2008编译lua</title>
		<link>http://dipplum.com/2009/11/09/visualc-compile-lua/</link>
		<comments>http://dipplum.com/2009/11/09/visualc-compile-lua/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 02:39:43 +0000</pubDate>
		<dc:creator>li</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[lua]]></category>
		<category><![CDATA[visualc]]></category>
		<category><![CDATA[win32]]></category>

		<guid isPermaLink="false">http://dipplum.com/2009/11/09/visualc-compile-lua/</guid>
		<description><![CDATA[1. 项目主页 http://www.lua.org/ 2. 当前最新稳定版本 5.1.4，2008年8月发布 &#160;&#160;&#160; 源码下载 http://www.lua.org/ftp/lua-5.1.4.tar.gz 3. VC编译方法 &#160;&#160;&#160; 解压后，用Visual Studio 2008命令行环境进入lua目录，运行etc\luavs.bat。之后会在src目录下生成lua.exe、luac.exe、lua51.dll 4. 注意 &#160;&#160;&#160; 默认的luavs.bat只会生成DLL，如果需要编译静态链接库，可以自行修改luavs.bat，修改两处地方 &#160;&#160;&#160; 1. 删除cl.exe的编译选项 /DLUA_BUILD_AS_DLL &#160;&#160;&#160; 2. 生成DLL的命令改成 lib.exe /nologo /out:lua.lib *.obj]]></description>
			<content:encoded><![CDATA[<p>1. 项目主页 <a href="http://www.lua.org/">http://www.lua.org/</a></p>
<p>2. 当前最新稳定版本 5.1.4，2008年8月发布</p>
<p>&#160;&#160;&#160; 源码下载 <a href="http://www.lua.org/ftp/lua-5.1.4.tar.gz">http://www.lua.org/ftp/lua-5.1.4.tar.gz</a></p>
<p>3. VC编译方法</p>
<p>&#160;&#160;&#160; 解压后，用Visual Studio 2008命令行环境进入lua目录，运行etc\luavs.bat。之后会在src目录下生成lua.exe、luac.exe、lua51.dll</p>
<p>4. 注意</p>
<p>&#160;&#160;&#160; 默认的luavs.bat只会生成DLL，如果需要编译静态链接库，可以自行修改luavs.bat，修改两处地方</p>
<p>&#160;&#160;&#160; 1. 删除cl.exe的编译选项 /DLUA_BUILD_AS_DLL</p>
<p>&#160;&#160;&#160; 2. 生成DLL的命令改成 lib.exe /nologo /out:lua.lib *.obj</p>
]]></content:encoded>
			<wfw:commentRss>http://dipplum.com/2009/11/09/visualc-compile-lua/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual C++ 2008编译zlib</title>
		<link>http://dipplum.com/2009/11/08/visualc-compile-zlib/</link>
		<comments>http://dipplum.com/2009/11/08/visualc-compile-zlib/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 10:27:46 +0000</pubDate>
		<dc:creator>li</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[asm]]></category>
		<category><![CDATA[visualc]]></category>
		<category><![CDATA[win32]]></category>
		<category><![CDATA[zlib]]></category>

		<guid isPermaLink="false">http://dipplum.com/2009/11/08/visualc-compile-zlib/</guid>
		<description><![CDATA[记录下Visual C++ 2008编译zlib的过程，以备不时之需。 1. 项目主页 http://www.zlib.net/ 2. 当前最新稳定版本 1.2.3，2005年7月发布 源码下载 http://www.zlib.net/zlib123.zip 3. VC编译方法 解压后，打开项目文件projects\visualc6\zlib.dsw，新版本的VC会提示要做工程格式转换。一般只编译其中zlib项目的DLL Release和LIB Release就好了。 4. Bug 如果想编译zlib的DLL ASM Release和LIB ASM Release，会出现下面的错误： contrib\masmx86\inffas32.asm&#40;647&#41; : error A2070:invalid instruction operands contrib\masmx86\inffas32.asm&#40;649&#41; : error A2070:invalid instruction operands contrib\masmx86\inffas32.asm&#40;663&#41; : error A2070:invalid instruction operands contrib\masmx86\inffas32.asm&#40;720&#41; : error A2070:invalid instruction operands 这是因为VC2008的MASM语法更严格了，导致之前的代码语法检查不过。参照这里的说明，把inffas32.asm改好就OK了。或者下载我改好的]]></description>
			<content:encoded><![CDATA[<p>记录下Visual C++ 2008编译zlib的过程，以备不时之需。</p>
<p>1. 项目主页 <a href="http://www.zlib.net/">http://www.zlib.net/</a></p>
<p>2. 当前最新稳定版本 1.2.3，2005年7月发布</p>
<p>源码下载 <a href="http://www.zlib.net/zlib123.zip">http://www.zlib.net/zlib123.zip</a></p>
<p>3. VC编译方法</p>
<p>解压后，打开项目文件projects\visualc6\zlib.dsw，新版本的VC会提示要做工程格式转换。一般只编译其中zlib项目的DLL Release和LIB Release就好了。</p>
<p>4. Bug</p>
<p>如果想编译zlib的DLL ASM Release和LIB ASM Release，会出现下面的错误：</p>

<div class="wp_syntax"><div class="code"><pre class="asm" style="font-family:monospace;">contrib\masmx86\inffas32<span style="color: #339933;">.</span>asm<span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #0000ff;">647</span><span style="color: #009900; font-weight: bold;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">error</span> A2070<span style="color: #339933;">:</span>invalid instruction operands
contrib\masmx86\inffas32<span style="color: #339933;">.</span>asm<span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #0000ff;">649</span><span style="color: #009900; font-weight: bold;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">error</span> A2070<span style="color: #339933;">:</span>invalid instruction operands
contrib\masmx86\inffas32<span style="color: #339933;">.</span>asm<span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #0000ff;">663</span><span style="color: #009900; font-weight: bold;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">error</span> A2070<span style="color: #339933;">:</span>invalid instruction operands
contrib\masmx86\inffas32<span style="color: #339933;">.</span>asm<span style="color: #009900; font-weight: bold;">&#40;</span><span style="color: #0000ff;">720</span><span style="color: #009900; font-weight: bold;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">error</span> A2070<span style="color: #339933;">:</span>invalid instruction operands</pre></div></div>

<p>这是因为VC2008的MASM语法更严格了，导致之前的代码语法检查不过。参照<a href="http://www.achacha.org/vc2008_zlib123/">这里</a>的说明，把inffas32.asm改好就OK了。或者下载我<a href="http://dipplum.com/download/6/">改好的</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dipplum.com/2009/11/08/visualc-compile-zlib/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visual C++ 2008编译SDL小结</title>
		<link>http://dipplum.com/2009/11/08/visualc-compile-sdl/</link>
		<comments>http://dipplum.com/2009/11/08/visualc-compile-sdl/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 09:42:26 +0000</pubDate>
		<dc:creator>li</dc:creator>
				<category><![CDATA[开源软件]]></category>
		<category><![CDATA[directx]]></category>
		<category><![CDATA[sdl]]></category>
		<category><![CDATA[visualc]]></category>
		<category><![CDATA[win32]]></category>

		<guid isPermaLink="false">http://dipplum.com/2009/11/08/visualc-compile-sdl/</guid>
		<description><![CDATA[最近在Windows平台上编译SDL，过程记录下来备忘。说是用VC 2008编译，其实和用VC 2005和VC 2010编译过程都是一样的。 1. SDL 主页 http://www.libsdl.org/ 2. 当前最新稳定版本 1.2.14 &#160;&#160;&#160; 源码 http://www.libsdl.org/release/SDL-1.2.14.zip 3. VC编译方法 &#160;&#160;&#160; SDL-1.2.14.zip解压后，再解压其中的VisualC.zip，然后用VC打开VisualC\SDL.sln。编译SDL和SDLmain两个工程。 4. 编译依赖 &#160;&#160;&#160; DirectX SDK中的dsound.h, dinput.h几个头文件，和dxguid.lib这个库文件。最新的DirectX SDK 2009 Auguest可以从微软（http://is.gd/4Q3Mo）下载。或者只下载其中include目录和lib目录打包（http://is.gd/4Q416）。 5. 注意 &#160;&#160;&#160; 这样通过SDL.sln编译出的SDL.dll依赖msvcr90.dll，需要目的端也装了VC 2009的redistributable才行。要么就用外置manifest文件的方法发布，还没搞懂，搞懂再写。]]></description>
			<content:encoded><![CDATA[<p>最近在Windows平台上编译SDL，过程记录下来备忘。说是用VC 2008编译，其实和用VC 2005和VC 2010编译过程都是一样的。</p>
<p>1. SDL 主页 <a href="http://www.libsdl.org/">http://www.libsdl.org/</a></p>
<p>2. 当前最新稳定版本 1.2.14</p>
<p>&#160;&#160;&#160; 源码 <a href="http://www.libsdl.org/release/SDL-1.2.14.zip">http://www.libsdl.org/release/SDL-1.2.14.zip</a></p>
<p>3. VC编译方法</p>
<p>&#160;&#160;&#160; SDL-1.2.14.zip解压后，再解压其中的VisualC.zip，然后用VC打开VisualC\SDL.sln。编译SDL和SDLmain两个工程。</p>
<p>4. 编译依赖</p>
<p>&#160;&#160;&#160; DirectX SDK中的dsound.h, dinput.h几个头文件，和dxguid.lib这个库文件。最新的DirectX SDK 2009 Auguest可以从微软（<a href="http://is.gd/4Q3Mo）">http://is.gd/4Q3Mo）</a>下载。或者只下载其中include目录和lib目录打包（<a href="http://is.gd/4Q416">http://is.gd/4Q416</a>）。</p>
<p>5. 注意</p>
<p>&#160;&#160;&#160; 这样通过SDL.sln编译出的SDL.dll依赖msvcr90.dll，需要目的端也装了VC 2009的redistributable才行。要么就用外置manifest文件的方法发布，还没搞懂，搞懂再写。</p>
]]></content:encoded>
			<wfw:commentRss>http://dipplum.com/2009/11/08/visualc-compile-sdl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

