﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" 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/"><channel><title>IT博客-sttx-文章分类-Windows</title><link>http://www.cnitblog.com/sttx/category/1611.html</link><description /><language>zh-cn</language><lastBuildDate>Wed, 05 Oct 2011 09:25:26 GMT</lastBuildDate><pubDate>Wed, 05 Oct 2011 09:25:26 GMT</pubDate><ttl>60</ttl><item><title>DLL工作原理</title><link>http://www.cnitblog.com/sttx/articles/5407.html</link><dc:creator>c++ and something</dc:creator><author>c++ and something</author><pubDate>Thu, 15 Dec 2005 07:58:00 GMT</pubDate><guid>http://www.cnitblog.com/sttx/articles/5407.html</guid><wfw:comment>http://www.cnitblog.com/sttx/comments/5407.html</wfw:comment><comments>http://www.cnitblog.com/sttx/articles/5407.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/sttx/comments/commentRss/5407.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/sttx/services/trackbacks/5407.html</trackback:ping><description><![CDATA[<DIV class=postText>
<P>创造DLL：<BR>1) 建立带有输出原型/结构/符号的头文件。<BR>2) 建立实现输出函数/变量的C/C++源文件。<BR>3) 编译器为每个C/C++源文件生成.obj模块。<BR>4) 链接程序将生成DLL的.obj模块链接起来。<BR>5) 如果至少输出一个函数/变量，那么链接程序也生成lib 文件。<BR>创造EXE：<BR>6) 建立带有输入原型/结构/符号的头文件。<BR>7) 建立引用输入函数/变量的C/C++源文件。<BR>8) 编译器为每个C/C++源文件生成.obj源文件。<BR>9) 链接程序将各个.obj模块链接起来，产生一个.exe文件(它包含了所需要DLL模块的名字和输入符号的列表)。<BR>运行应用程序：<BR>10) 加载程序为.exe 创建地址空间。<BR>11) 加载程序将需要的DLL加载到地址空间中进程的主线程开始执行；应用程序启动运行</P>
<P>其中,创建DLL时的步骤1)生成的.h头文件,在创建exe的时候需要用到.除非你使用动态加载,创建DLL步骤5)中生成的lib文件也要在链接exe文件时用到.此外,exe程序运行时还需要生成的DLL文件.<BR>即:对于exe程序,需要用到<BR>编译时--------DLL头文件(.h)<BR>链接时--------DLL库文件(.lib)<BR>运行时--------DLL文件(.DLL)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P>
<P>以上参考&lt;WINDOWS核心编程&gt;&nbsp;&nbsp;&nbsp;&nbsp;第19章,本来还有一个图形,很形象,一看就明白的.可惜不知道怎么贴出来,只好作罢.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P></DIV><img src ="http://www.cnitblog.com/sttx/aggbug/5407.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/sttx/" target="_blank">c++ and something</a> 2005-12-15 15:58 <a href="http://www.cnitblog.com/sttx/articles/5407.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>