锘??xml version="1.0" encoding="utf-8" standalone="yes"?>这里只有视频精品,黑人巨大精品欧美黑白配亚洲,午夜精品一区二区三区四区http://www.shnenglu.com/suiaiguo/category/11218.html澶╄鍋ワ紝鍚涘瓙浠ヨ嚜寮轟笉鎭紱 鍦板娍鍧わ紝鍚涘瓙浠ュ帤寰瘋澆鐗?/description>zh-cnTue, 21 Jul 2009 09:02:13 GMTTue, 21 Jul 2009 09:02:13 GMT60DLL鍏ラ棬嫻呮瀽錛?錛夆斺斾嬌鐢―LL鍦ㄨ繘紼嬮棿鍏變韓鏁版嵁http://www.shnenglu.com/suiaiguo/archive/2009/07/21/90734.htmlSagaSagaTue, 21 Jul 2009 07:06:00 GMThttp://www.shnenglu.com/suiaiguo/archive/2009/07/21/90734.htmlhttp://www.shnenglu.com/suiaiguo/comments/90734.htmlhttp://www.shnenglu.com/suiaiguo/archive/2009/07/21/90734.html#Feedback0http://www.shnenglu.com/suiaiguo/comments/commentRss/90734.htmlhttp://www.shnenglu.com/suiaiguo/services/trackbacks/90734.html         鍦╓in16鐜涓紝DLL鐨勫叏灞鏁版嵁瀵規瘡涓澆鍏ュ畠鐨勮繘紼嬫潵璇撮兘鏄浉鍚岀殑,鍥犱負鎵鏈夌殑榪涚▼鐢ㄧ殑閮芥敹鍚屼竴鍧楀湴鍧絀洪棿錛涜屽湪Win32鐜涓紝鎯呭喌鍗村彂鐢熶簡鍙樺寲錛屾瘡涓繘紼嬮兘鏈変簡瀹冭嚜宸辯殑鍦板潃絀洪棿錛孌LL鍑芥暟涓殑浠g爜鎵鍒涘緩鐨勪換浣曞璞★紙鍖呮嫭鍙橀噺錛夐兘褰掕皟鐢ㄥ畠鐨勮繘紼嬫墍鏈夈傚綋榪涚▼鍦ㄨ澆鍏LL鏃訛紝鎿嶄綔緋葷粺鑷姩鎶奃LL鍦板潃鏄犲皠鍒拌榪涚▼鐨勭鏈夌┖闂達紝涔熷氨鏄繘紼嬬殑铏氭嫙鍦板潃絀洪棿錛岃屼笖涔熷鍒惰DLL鐨勫叏灞鏁版嵁鐨勪竴浠芥嫹璐濆埌璇ヨ繘紼嬬┖闂淬傦紙鍦ㄧ墿鐞嗗唴瀛樹腑錛屽榪涚▼杞藉叆DLL鏃訛紝DLL鐨勪唬鐮佹瀹為檯涓婃槸鍙姞杞戒簡涓嬈★紝鍙槸灝嗙墿鐞嗗湴鍧鏄犲皠鍒頒簡鍚勪釜璋冪敤瀹冪殑榪涚▼鐨勮櫄鎷熷湴鍧絀洪棿涓紝鑰屽叏灞鏁版嵁浼氬湪姣忎釜榪涚▼閮藉垎鍒姞杞斤級銆備篃灝辨槸璇存瘡涓繘紼嬫墍鎷ユ湁鐨勭浉鍚岀殑DLL鐨勫叏灞鏁版嵁錛屽畠浠殑鍚嶇О鐩稿悓錛屼絾鍏跺煎嵈騫朵笉涓瀹氭槸鐩稿悓鐨勶紝鑰屼笖鏄簰涓嶅共娑夌殑銆?br>鍥犳錛屽湪Win32鐜涓嬭鎯沖湪澶氫釜榪涚▼涓叡浜暟鎹紝灝卞繀欏昏繘琛屽繀瑕佺殑璁劇疆銆傚湪璁塊棶鍚屼竴涓狣ll鐨勫悇榪涚▼涔嬮棿鍏變韓瀛樺偍鍣ㄦ槸閫氳繃瀛樺偍鍣ㄦ槧灝勬枃浠舵妧鏈疄鐜扮殑銆備篃鍙互鎶婅繖浜涢渶瑕佸叡浜殑鏁版嵁鍒嗙鍑烘潵錛屾斁緗湪涓涓嫭绔嬬殑鏁版嵁孌甸噷錛屽茍鎶婅孌電殑灞炴ц緗負鍏變韓銆傚繀欏葷粰榪欎簺鍙橀噺璧嬪垵鍊鹼紝鍚﹀垯緙栬瘧鍣ㄤ細鎶婃病鏈夎祴鍒濆鍊肩殑鍙橀噺鏀懼湪涓涓彨鏈鍒濆鍖栫殑鏁版嵁孌典腑銆?/p>

鍦―LL鐨勫疄鐜版枃浠朵腑娣誨姞涓嬪垪浠g爜錛?/p>

#pragma data_seg("DLLSharedSection")      // 澹版槑鍏變韓鏁版嵁孌碉紝騫跺懡鍚嶈鏁版嵁孌?/span>
   int SharedData = 123;       // 蹇呴』鍦ㄥ畾涔夌殑鍚屾椂榪涜鍒濆鍖?!!!
#pragma data_seg()

 

 鍦?pragma data_seg("DLLSharedSection")鍜?pragma data_seg()涔嬮棿鐨勬墍鏈夊彉閲忓皢琚闂Dll鐨勬墍鏈夎繘紼嬬湅鍒板拰鍏變韓銆備粎瀹氫箟涓涓暟鎹榪樹笉鑳借揪鍒板叡浜暟鎹殑鐩殑錛岃繕瑕佸憡璇夌紪璇戝櫒璇ユ鐨勫睘鎬э紝鏈変笁縐嶆柟娉曞彲浠ュ疄鐜拌鐩殑錛堝叾鏁堟灉鏄浉鍚岀殑錛夛紝涓縐嶆柟娉曟槸鍦?DEF鏂囦歡涓姞鍏ュ涓嬭鍙ワ細

SETCTIONS
    DLLSharedSection READ WRITE SHARED

 

鍙︿竴縐嶆柟娉曟槸鍦ㄩ」鐩緗殑閾炬帴閫夐」(Project Setting --銆塋ink)涓姞鍏ュ涓嬭鍙ワ細

/SECTION:DLLSharedSection,rws

 

榪樻湁涓縐嶅氨鏄嬌鐢ㄦ寚浠わ細

#pragma comment(linker,"/section:.DLLSharedSection,rws")


閭d箞榪欎釜鏁版嵁鑺備腑鐨勬暟鎹彲浠ュ湪鎵鏈塂LL鐨勫疄渚嬩箣闂村叡浜簡銆傛墍鏈夊榪欎簺鏁版嵁鐨勬搷浣滈兘閽堝鍚屼竴涓疄渚嬬殑錛岃屼笉鏄湪姣忎釜榪涚▼鐨勫湴鍧絀洪棿涓兘鏈変竴浠姐?br> 
褰撹繘紼嬮殣寮忔垨鏄懼紡璋冪敤涓涓姩鎬佸簱閲岀殑鍑芥暟鏃訛紝緋葷粺閮借鎶婅繖涓姩鎬佸簱鏄犲皠鍒拌繖涓繘紼嬬殑铏氭嫙鍦板潃絀洪棿閲屻傝繖浣垮緱DLL鎴愪負榪涚▼鐨勪竴閮ㄥ垎錛屼互榪欎釜榪涚▼鐨勮韓浠芥墽琛岋紝浣跨敤榪欎釜榪涚▼鐨勫爢鏍堛?/p>

涓嬮潰鏉ヨ皥涓涓嬪湪鍏蜂綋浣跨敤鍏變韓鏁版嵁孌墊椂闇瑕佹敞鎰忕殑涓浜涢棶棰橈細

·         鎵鏈夊湪鍏變韓鏁版嵁孌典腑鐨勫彉閲忥紝鍙湁鍦ㄦ暟鎹涓粡榪囦簡鍒濆鍖栦箣鍚庯紝鎵嶄細鏄繘紼嬮棿鍏變韓鐨勩傚鏋滄病鏈夊垵濮嬪寲錛岄偅涔堣繘紼嬮棿璁塊棶璇ュ彉閲忓垯鏄湭瀹氫箟鐨勩?br>·         鎵鏈夌殑鍏變韓鍙橀噺閮借鏀劇疆鍦ㄥ叡浜暟鎹涓傚浣曞畾涔夊緢澶х殑鏁扮粍錛岄偅涔堜篃浼氬鑷村緢澶х殑DLL銆?br>·         涓嶈鍦ㄥ叡浜暟鎹涓瓨鏀捐繘紼嬬浉鍏崇殑淇℃伅銆俉in32涓ぇ澶氭暟鐨勬暟鎹粨鏋勫拰鍊鹼紙姣斿HANDLE錛夊彧鍦ㄧ壒瀹氱殑榪涚▼涓婁笅鏂囦腑鎵嶆槸鏈夋晥鍦般?br>·         姣忎釜榪涚▼閮芥湁瀹冭嚜宸辯殑鍦板潃絀洪棿銆傚洜姝や笉瑕佸湪鍏變韓鏁版嵁孌典腑鍏變韓鎸囬拡錛屾寚閽堟寚鍚戠殑鍦板潃鍦ㄤ笉鍚岀殑鍦板潃絀洪棿涓槸涓嶄竴鏍風殑銆?br>·         DLL鍦ㄦ瘡涓繘紼嬩腑鏄鏄犲皠鍦ㄤ笉鍚岀殑铏氭嫙鍦板潃絀洪棿涓殑錛屽洜姝ゅ嚱鏁版寚閽堜篃鏄笉瀹夊叏鐨勩?br>
褰撶劧榪樻湁鍏跺畠鐨勬柟娉曟潵榪涜榪涚▼闂寸殑鏁版嵁鍏變韓錛屾瘮濡傛枃浠跺唴瀛樻槧灝勭瓑錛岃繖灝辨秹鍙婂埌閫氱敤鐨勮繘紼嬮棿閫氫俊浜嗭紝榪欓噷灝變笉澶氳浜嗐?/p>

Saga 2009-07-21 15:06 鍙戣〃璇勮
]]>
DLL鍏ラ棬嫻呮瀽錛?錛夆斺斾粠DLL涓鍑虹被http://www.shnenglu.com/suiaiguo/archive/2009/07/20/90663.htmlSagaSagaMon, 20 Jul 2009 12:50:00 GMThttp://www.shnenglu.com/suiaiguo/archive/2009/07/20/90663.htmlhttp://www.shnenglu.com/suiaiguo/comments/90663.htmlhttp://www.shnenglu.com/suiaiguo/archive/2009/07/20/90663.html#Feedback4http://www.shnenglu.com/suiaiguo/comments/commentRss/90663.htmlhttp://www.shnenglu.com/suiaiguo/services/trackbacks/90663.html
DLL澶存枃浠訛細
#ifndef _DLL_SAMPLE_H
#define _DLL_SAMPLE_H

// 閫氳繃瀹忔潵鎺у埗鏄鍏ヨ繕鏄鍑?/span>
#ifdef _DLL_SAMPLE
#define DLL_SAMPLE_API __declspec(dllexport)
#else
#define DLL_SAMPLE_API __declspec(dllimport)
#endif

// 瀵煎嚭/瀵煎叆鍙橀噺澹版槑
DLL_SAMPLE_API class DLLClass
{
  
public:
    
void Show();
}
;

#undef DLL_SAMPLE_API

#endif

DLL瀹炵幇鏂囦歡錛?
#include "stdafx.h"
#define _DLL_SAMPLE

#ifndef _DLL_SAMPLE_H
#include 
"DLLSample.h"
#endif

#include 
"stdio.h"

//APIENTRY澹版槑DLL鍑芥暟鍏ュ彛鐐?/span>
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
銆銆
case DLL_PROCESS_ATTACH:
銆銆
case DLL_THREAD_ATTACH:
銆銆
case DLL_THREAD_DETACH:
銆銆
case DLL_PROCESS_DETACH:
銆銆銆
break;
銆}

return TRUE;
}


void DLLClass::Show()
{
  printf(
"DLLClass show!");
}

搴旂敤紼嬪簭璋冪敤DLL
#include "DLLSample.h"

#pragma comment(lib,
"DLLSample.lib")


int main(int argc, char *argv[])
{
銆DLLClass dc;
  dc.Show();
return 0;
}


澶у鍙兘鍙戠幇浜嗭紝涓婇潰鎴戞病鏈変嬌鐢ㄦā鍧楀畾涔夋枃浠訛紙.def錛夊0鏄庡鍑虹被涔熸病鏈夌敤鏄懼紡閾炬帴瀵煎叆DLL銆?
鐢―epends鏌ョ湅鍓嶉潰緙栬瘧鍑烘潵鐨凞LL鏂囦歡錛屼細鍙戠幇閲岄潰瀵煎嚭浜嗗緢濂囨殑symbol錛岃繖鏄洜涓篊++緙栬瘧鍣ㄥ湪緙栬瘧鏃朵細瀵箂ymbol榪涜淇グ銆?br>榪欐槸鎴戜粠鍒漢閭e効杞潵鐨勬埅鍥俱?/p>



緗戜笂鎵句簡涓嬶紝鍙戠幇浜咰++緙栬瘧鏃跺嚱鏁板悕鐨勪慨楗扮害瀹氳鍒?/p>

__stdcall璋冪敤綰﹀畾錛?/p>

1銆佷互"?"鏍囪瘑鍑芥暟鍚嶇殑寮濮嬶紝鍚庤窡鍑芥暟鍚嶏紱
2銆佸嚱鏁板悕鍚庨潰浠?@@YG"鏍囪瘑鍙傛暟琛ㄧ殑寮濮嬶紝鍚庤窡鍙傛暟琛紱
3銆佸弬鏁拌〃浠ヤ唬鍙瘋〃紺猴細

X鈥斺攙oid錛?br>D鈥斺攃har錛?br>E鈥斺攗nsigned char錛?br>F鈥斺攕hort錛?br>H鈥斺攊nt錛?br>I鈥斺攗nsigned int錛?br>J鈥斺攍ong錛?br>K鈥斺攗nsigned long錛?br>M鈥斺攆loat錛?br>N鈥斺攄ouble錛?br>_N鈥斺攂ool錛?br>....

銆銆PA鈥斺旇〃紺烘寚閽堬紝鍚庨潰鐨勪唬鍙瘋〃鏄庢寚閽堢被鍨嬶紝濡傛灉鐩稿悓綾誨瀷鐨勬寚閽堣繛緇嚭鐜幫紝浠?0"浠f浛錛屼竴涓?0"浠h〃涓嬈¢噸澶嶏紱
4銆佸弬鏁拌〃鐨勭涓欏逛負璇ュ嚱鏁扮殑榪斿洖鍊肩被鍨嬶紝鍏跺悗渚濇涓哄弬鏁扮殑鏁版嵁綾誨瀷,鎸囬拡鏍囪瘑鍦ㄥ叾鎵鎸囨暟鎹被鍨嬪墠錛?
5銆佸弬鏁拌〃鍚庝互"@Z"鏍囪瘑鏁翠釜鍚嶅瓧鐨勭粨鏉燂紝濡傛灉璇ュ嚱鏁版棤鍙傛暟錛屽垯浠?Z"鏍囪瘑緇撴潫銆?br>銆銆鍏舵牸寮忎負"?functionname@@YG*****@Z"鎴?a href="mailto:?functionname@@YG*XZ">?functionname@@YG*XZ錛?/p>

    int Test1錛坈har *var1,unsigned long錛?a href="mailto:-----“?Test1@@YGHPADK@Z”">-----“?Test1@@YGHPADK@Z”
     void Test2錛堬級                          -----“?Test2@@YGXXZ”

__cdecl璋冪敤綰﹀畾錛?br>銆銆瑙勫垯鍚屼笂闈㈢殑_stdcall璋冪敤綰﹀畾錛屽彧鏄弬鏁拌〃鐨勫紑濮嬫爣璇嗙敱涓婇潰鐨?@@YG"鍙樹負"@@YA"銆?/p>

__fastcall璋冪敤綰﹀畾錛?br>銆銆瑙勫垯鍚屼笂闈㈢殑_stdcall璋冪敤綰﹀畾錛屽彧鏄弬鏁拌〃鐨勫紑濮嬫爣璇嗙敱涓婇潰鐨?@@YG"鍙樹負"@@YI"銆?br>
VC++瀵瑰嚱鏁扮殑鐪佺己澹版槑鏄?__cedcl",灝嗗彧鑳借C/C++璋冪敤銆?br>
铏界劧鍥犱負C++緙栬瘧鍣ㄥsymbol榪涜淇グ鐨勫師鍥犱笉鑳界洿鎺ョ敤def鏂囦歡澹版槑瀵煎嚭綾誨拰鏄懼紡閾炬帴錛屼絾鏄彲浠ョ敤鍙﹀涓縐嶅彇宸х殑鏂瑰紡銆?/p> 鍦ㄥご鏂囦歡涓被鐨勫0鏄庝腑娣誨姞涓涓弸鍏冨嚱鏁幫細
friend DLLClass* CreatDLLClass();
鐒跺悗澹版槑CreatDLLClass()涓哄鍑哄嚱鏁幫紝閫氳繃璋冪敤璇ュ嚱鏁拌繑鍥炰竴涓狣LLClass綾葷殑瀵硅薄錛屽悓鏍瘋揪鍒頒簡瀵煎嚭綾葷殑鐩殑銆?br>榪欐牱錛屽氨鍙互鐢ㄦ樉寮忛摼鎺ユ潵璋冪敤CreatDLLClass()錛屼粠鑰屽緱鍒扮被瀵硅薄浜嗐?

Saga 2009-07-20 20:50 鍙戣〃璇勮
]]>
DLL鍏ラ棬嫻呮瀽錛?錛夆斺斾粠DLL涓鍑哄彉閲?/title><link>http://www.shnenglu.com/suiaiguo/archive/2009/07/20/90643.html</link><dc:creator>Saga</dc:creator><author>Saga</author><pubDate>Mon, 20 Jul 2009 09:37:00 GMT</pubDate><guid>http://www.shnenglu.com/suiaiguo/archive/2009/07/20/90643.html</guid><wfw:comment>http://www.shnenglu.com/suiaiguo/comments/90643.html</wfw:comment><comments>http://www.shnenglu.com/suiaiguo/archive/2009/07/20/90643.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/suiaiguo/comments/commentRss/90643.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/suiaiguo/services/trackbacks/90643.html</trackback:ping><description><![CDATA[<p>   鍓嶉潰浠嬬粛浜嗘庝箞浠嶥LL涓鍑哄嚱鏁幫紝涓嬮潰鎴戜滑鏉ョ湅涓涓嬪浣曚粠DLL涓鍑哄彉閲忔潵銆?/p> <p>   澹版槑涓哄鍑哄彉閲忔椂錛屽悓鏍鋒湁涓ょ鏂規硶錛?br>   絎竴縐嶆槸鐢╛_declspec榪涜瀵煎嚭澹版槑</p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">#ifndef _DLL_SAMPLE_H<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000"> _DLL_SAMPLE_H</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 濡傛灉瀹氫箟浜咰++緙栬瘧鍣紝閭d箞澹版槑涓篊閾炬帴鏂瑰紡</span><span style="COLOR: #008000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">#ifdef __cplusplus<br><img id=Codehighlighter1_101_342_Open_Image onclick="this.style.display='none'; Codehighlighter1_101_342_Open_Text.style.display='none'; Codehighlighter1_101_342_Closed_Image.style.display='inline'; Codehighlighter1_101_342_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_101_342_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_101_342_Closed_Text.style.display='none'; Codehighlighter1_101_342_Open_Image.style.display='inline'; Codehighlighter1_101_342_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span style="COLOR: #0000ff">extern</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">C</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"> </span><span id=Codehighlighter1_101_342_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_101_342_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">#endif</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 閫氳繃瀹忔潵鎺у埗鏄鍏ヨ繕鏄鍑?/span><span style="COLOR: #008000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">#ifdef _DLL_SAMPLE<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000"> DLL_SAMPLE_API __declspec(dllexport)</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">#else</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000"> DLL_SAMPLE_API __declspec(dllimport)</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">#endif</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 瀵煎嚭/瀵煎叆鍙橀噺澹版槑</span><span style="COLOR: #008000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">DLL_SAMPLE_API </span><span style="COLOR: #0000ff">extern</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> DLLData;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #0000ff">#undef</span><span style="COLOR: #000000"> DLL_SAMPLE_API</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>#ifdef __cplusplus<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#endif</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#endif</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> <p> </p> <p>  絎簩縐嶆槸鐢ㄦā鍧楀畾涔夋枃浠訛紙.def錛夎繘琛屽鍑哄0鏄?/p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">LIBRARY DLLSample<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>DESCRIPTION </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">my simple DLL</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>EXPORTS<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>        DLLData DATA  錛汥ATA琛ㄧず榪欐槸鏁版嵁錛堝彉閲忥級</span></div> <p> </p>    涓嬮潰鏄疍LL鐨勫疄鐜版枃浠? <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">stdafx.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#define</span><span style="COLOR: #000000"> _DLL_SAMPLE</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#ifndef _DLL_SAMPLE_H<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">DLLSample.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">#endif</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">stdio.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> DLLData;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">APIENTRY澹版槑DLL鍑芥暟鍏ュ彛鐐?/span><span style="COLOR: #008000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #000000">BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)<br><img id=Codehighlighter1_232_451_Open_Image onclick="this.style.display='none'; Codehighlighter1_232_451_Open_Text.style.display='none'; Codehighlighter1_232_451_Closed_Image.style.display='inline'; Codehighlighter1_232_451_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_232_451_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_232_451_Closed_Text.style.display='none'; Codehighlighter1_232_451_Open_Image.style.display='inline'; Codehighlighter1_232_451_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_232_451_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_232_451_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>銆</span><span style="COLOR: #0000ff">switch</span><span style="COLOR: #000000"> (ul_reason_for_call)<br><img id=Codehighlighter1_264_435_Open_Image onclick="this.style.display='none'; Codehighlighter1_264_435_Open_Text.style.display='none'; Codehighlighter1_264_435_Closed_Image.style.display='inline'; Codehighlighter1_264_435_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_264_435_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_264_435_Closed_Text.style.display='none'; Codehighlighter1_264_435_Open_Image.style.display='inline'; Codehighlighter1_264_435_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>銆</span><span id=Codehighlighter1_264_435_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_264_435_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>銆銆</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> DLL_PROCESS_ATTACH:<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>      DLLData </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">123</span><span style="COLOR: #000000">;  </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> 鍦ㄥ叆鍙e嚱鏁頒腑瀵瑰彉閲忚繘琛屽垵濮嬪寲</span><span style="COLOR: #008000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top></span><span style="COLOR: #000000">      </span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>銆銆</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> DLL_THREAD_ATTACH:<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>銆銆</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> DLL_THREAD_DETACH:<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>銆銆</span><span style="COLOR: #0000ff">case</span><span style="COLOR: #000000"> DLL_PROCESS_DETACH:<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>銆銆銆</span><span style="COLOR: #0000ff">break</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>銆}</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>銆</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> TRUE;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> <p><br>鍚屾牱錛屽簲鐢ㄧ▼搴忚皟鐢―LL涓殑鍙橀噺涔熸湁涓ょ鏂規硶銆?br>絎竴縐嶆槸闅愬紡閾炬帴錛?/p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">stdio.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">DLLSample.h</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#pragma comment(lib,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">DLLSample.lib</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> argc, </span><span style="COLOR: #0000ff">char</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">argv[])<br><img id=Codehighlighter1_115_155_Open_Image onclick="this.style.display='none'; Codehighlighter1_115_155_Open_Text.style.display='none'; Codehighlighter1_115_155_Closed_Image.style.display='inline'; Codehighlighter1_115_155_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_115_155_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_115_155_Closed_Text.style.display='none'; Codehighlighter1_115_155_Open_Image.style.display='inline'; Codehighlighter1_115_155_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_115_155_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_115_155_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>銆printf(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">%d </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, DLLSample);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>銆</span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">0</span><span style="COLOR: #000000">;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> <p> <br>絎簩縐嶆槸鏄懼紡閾炬帴錛?/p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><span style="COLOR: #000000">#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">iostream</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top>#include </span><span style="COLOR: #000000"><</span><span style="COLOR: #000000">windows.h</span><span style="COLOR: #000000">></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> main()<br><img id=Codehighlighter1_53_484_Open_Image onclick="this.style.display='none'; Codehighlighter1_53_484_Open_Text.style.display='none'; Codehighlighter1_53_484_Closed_Image.style.display='inline'; Codehighlighter1_53_484_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockStart.gif" align=top><img id=Codehighlighter1_53_484_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_53_484_Closed_Text.style.display='none'; Codehighlighter1_53_484_Open_Image.style.display='inline'; Codehighlighter1_53_484_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedBlock.gif" align=top></span><span id=Codehighlighter1_53_484_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_53_484_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000"> my_int;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        HINSTANCE hInstLibrary </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> LoadLibrary(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">DLLSample.dll</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (hInstLibrary </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> NULL)<br><img id=Codehighlighter1_181_227_Open_Image onclick="this.style.display='none'; Codehighlighter1_181_227_Open_Text.style.display='none'; Codehighlighter1_181_227_Closed_Image.style.display='inline'; Codehighlighter1_181_227_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_181_227_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_181_227_Closed_Text.style.display='none'; Codehighlighter1_181_227_Open_Image.style.display='inline'; Codehighlighter1_181_227_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span id=Codehighlighter1_181_227_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_181_227_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>         FreeLibrary(hInstLibrary);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        my_int </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">int</span><span style="COLOR: #000000">*</span><span style="COLOR: #000000">)GetProcAddress(hInstLibrary, </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">DLLData</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (dllFunc </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> NULL)<br><img id=Codehighlighter1_331_377_Open_Image onclick="this.style.display='none'; Codehighlighter1_331_377_Open_Text.style.display='none'; Codehighlighter1_331_377_Closed_Image.style.display='inline'; Codehighlighter1_331_377_Closed_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif" align=top><img id=Codehighlighter1_331_377_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_331_377_Closed_Text.style.display='none'; Codehighlighter1_331_377_Open_Image.style.display='inline'; Codehighlighter1_331_377_Open_Text.style.display='inline';" src="http://www.shnenglu.com/Images/OutliningIndicators/ContractedSubBlock.gif" align=top>        </span><span id=Codehighlighter1_331_377_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><img src="http://www.shnenglu.com/Images/dot.gif"></span><span id=Codehighlighter1_331_377_Open_Text><span style="COLOR: #000000">{<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>         FreeLibrary(hInstLibrary);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif" align=top>        }</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        std::cout</span><span style="COLOR: #000000"><<</span><span style="COLOR: #000000">my_int;<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        std::cin.</span><span style="COLOR: #0000ff">get</span><span style="COLOR: #000000">();<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        FreeLibrary(hInstLibrary);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/InBlock.gif" align=top>        </span><span style="COLOR: #0000ff">return</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">);<br><img src="http://www.shnenglu.com/Images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>}</span></span><span style="COLOR: #000000"><br><img src="http://www.shnenglu.com/Images/OutliningIndicators/None.gif" align=top></span></div> <p> </p> <p>閫氳繃GetProcAddress鍙栧嚭鐨勫嚱鏁版垨鑰呭彉閲忛兘鏄湴鍧錛屽洜姝わ紝闇瑕佽В寮曠敤騫朵笖杞被鍨嬨?/p> <p><br> </p> <img src ="http://www.shnenglu.com/suiaiguo/aggbug/90643.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/suiaiguo/" target="_blank">Saga</a> 2009-07-20 17:37 <a href="http://www.shnenglu.com/suiaiguo/archive/2009/07/20/90643.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>DLL鍏ラ棬嫻呮瀽錛?錛夆斺斿浣曚嬌鐢―LLhttp://www.shnenglu.com/suiaiguo/archive/2009/07/20/90621.htmlSagaSagaMon, 20 Jul 2009 06:27:00 GMThttp://www.shnenglu.com/suiaiguo/archive/2009/07/20/90621.htmlhttp://www.shnenglu.com/suiaiguo/comments/90621.htmlhttp://www.shnenglu.com/suiaiguo/archive/2009/07/20/90621.html#Feedback1http://www.shnenglu.com/suiaiguo/comments/commentRss/90621.htmlhttp://www.shnenglu.com/suiaiguo/services/trackbacks/90621.html涓婃枃鎴戠畝鍗曠殑浠嬬粛浜嗗浣曞緩绔嬩竴涓畝鍗旸LL錛屼笅闈㈠啀鎴戠畝鍗曠殑浠嬬粛涓涓嬪浣曚嬌鐢ㄤ竴涓狣LL銆傚綋涓涓狣LL琚敓鎴愬悗錛屽畠鍒涘緩浜嗕竴涓?dll鏂囦歡鍜屼竴涓?lib鏂囦歡錛涜繖涓や釜閮芥槸浣犻渶瑕佺殑銆傝浣跨敤DLL錛屽氨闇瑕佽澆鍏ヨ繖涓狣LL銆?/p>

闅愬紡閾炬帴

榪欓噷鏈変袱涓柟娉曟潵杞藉叆涓涓狣LL錛涗竴涓柟娉曟槸鎹峰緞鍙︿竴涓垯鐩告瘮瑕佸鏉備簺銆傛嵎寰勬槸鍙摼鎺ュ埌浣?lib 鏂囦歡騫跺皢.dll鏂囦歡緗叆浣犵殑鏂伴」鐩殑璺緞涓幓銆傚洜姝わ紝鍒涘緩涓涓柊鐨勭┖鐨刉in32鎺у埗鍙伴」鐩茍娣誨姞涓涓簮鏂囦歡銆傚皢浣犲仛鐨凞LL鏀懼叆浣犵殑鏂伴」鐩浉鍚岀殑鐩綍涓嬨?/p>

#include "stdafx.h"
#include 
"DLLSample.h"

#pragma comment(lib, 
"DLLSample.lib"//浣犱篃鍙互鍦ㄩ」鐩睘鎬т腑璁劇疆搴撶殑閾炬帴

int main()
{
        TestDLL(
123);
        
return(1);
}

榪欏氨鏄澆鍏ヤ竴涓狣LL鐨勭畝鍗曟柟娉曘?/p>

鏄懼紡閾炬帴

闅劇偣鐨勫姞杞紻LL鐨勬柟娉曠◢寰湁鐐瑰鏉傘備綘灝嗛渶瑕佸嚱鏁版寚閽堝拰涓浜沇indows鍑芥暟銆備絾鏄紝閫氳繃榪欑杞藉叆DLLs鐨勬柟娉曪紝浣犱笉闇瑕丏LL鐨?lib鎴栧ご鏂囦歡錛岃屽彧闇瑕丏LL銆?/p>

#include <iostream>
#include 
<windows.h>
typedef 
void (*DLLFunc)(int);
int main()
{
        DLLFunc dllFunc;
        HINSTANCE hInstLibrary 
= LoadLibrary("DLLSample.dll");

        
if (hInstLibrary == NULL)
        
{
         FreeLibrary(hInstLibrary);
        }

        dllFunc 
= (DLLFunc)GetProcAddress(hInstLibrary, "TestDLL");
        
if (dllFunc == NULL)
        
{
         FreeLibrary(hInstLibrary);
        }

        dllFunc(
123);
        std::cin.
get();
        FreeLibrary(hInstLibrary);
        
return(1);
}

     
棣栧厛浣犱細娉ㄦ剰鍒幫細榪欓噷鍖呮嫭榪涗簡鏂囦歡“windows.h”鍚屾椂縐昏蛋浜?#8220;DLLSample.h”銆傚師鍥犲緢綆鍗曪細鍥犱負windows.h鍖呭惈浜嗕竴浜沇indows鍑芥暟錛屽綋鐒朵綘鐜板湪灝嗗彧闇瑕佸叾涓嚑涓屽凡銆傚畠涔熷寘鍚簡涓浜涘皢浼氱敤鍒扮殑Windows鐗瑰畾鍙橀噺銆備綘鍙互鍘繪帀DLL鐨勫ご鏂囦歡錛圖LLSample.h錛夊洜涓猴紞濡傛垜鍓嶉潰鎵璇達紞褰撲綘浣跨敤榪欎釜鏂規硶杞藉叆DLL鏃朵綘騫朵笉闇瑕佸畠銆?/p>

涓嬮潰浣犱細鐪嬪埌錛氫笅闈㈢殑涓鍙ヤ唬鐮?

typedef void (*DLLFunc)(int);
     
榪欐槸涓涓嚱鏁版寚閽堢被鍨嬬殑瀹氫箟銆傛寚鍚戜竴涓嚱鏁版槸涓涓猧nt鍨嬬殑鍙傛暟錛岃繑鍥炲間負void綾誨瀷銆?/p>

涓涓狧INSTANCE鏄竴涓猈indows鏁版嵁綾誨瀷錛氭槸涓涓疄渚嬬殑鍙ユ焺錛涘湪姝ゆ儏鍐典笅錛岃繖涓疄渚嬪皢鏄繖涓狣LL銆備綘鍙互閫氳繃浣跨敤鍑芥暟LoadLibrary()鑾峰緱DLL鐨勫疄渚嬶紝瀹冭幏寰椾竴涓悕縐頒綔涓哄弬鏁般傚湪璋冪敤LoadLibrary鍑芥暟鍚庯紝浣犲繀闇鏌ョ湅涓涓嬪嚱鏁拌繑鍥炴槸鍚︽垚鍔熴備綘鍙互閫氳繃媯鏌INSTANCE鏄惁絳変簬NULL錛堝湪Windows.h涓畾涔変負0鎴朩indows.h鍖呭惈鐨勪竴涓ご鏂囦歡錛夋潵鏌ョ湅鍏舵槸鍚︽垚鍔熴傚鏋滃叾絳変簬NULL錛岃鍙ユ焺灝嗘槸鏃犳晥鐨勶紝騫朵笖浣犲繀闇閲婃斁榪欎釜搴撱傛崲鍙ヨ瘽璇達紝浣犲繀闇閲婃斁DLL鑾峰緱鐨勫唴瀛樸傚鏋滃嚱鏁拌繑鍥炴垚鍔燂紝浣犵殑HINSTANCE灝卞寘鍚簡鎸囧悜DLL鐨勫彞鏌勩?/p>

涓鏃︿綘鑾峰緱浜嗘寚鍚慏LL鐨勫彞鏌勶紝浣犵幇鍦ㄥ彲浠ヤ粠DLL涓噸鏂拌幏寰楀嚱鏁般備負浜嗚繖鏍蜂綔錛屼綘蹇呴』浣跨敤鍑芥暟GetProcAddress()錛屽畠灝咲LL鐨勫彞鏌勶紙浣犲彲浠ヤ嬌鐢℉INSTANCE錛夊拰鍑芥暟鐨勫悕縐頒綔涓哄弬鏁般備綘鍙互璁╁嚱鏁版寚閽堣幏寰楃敱GetProcAddress()榪斿洖鐨勫鹼紝鍚屾椂浣犲繀闇灝咷etProcAddress()杞崲涓洪偅涓嚱鏁板畾涔夌殑鍑芥暟鎸囬拡銆備婦涓緥瀛愶紝瀵逛簬Add()鍑芥暟錛屼綘蹇呴渶灝咷etProcAddress()杞崲涓篈ddFunc錛涜繖灝辨槸瀹冪煡閬撳弬鏁板強榪斿洖鍊肩殑鍘熷洜銆傜幇鍦紝鏈濂藉厛紜畾鍑芥暟鎸囬拡鏄惁絳変簬NULL浠ュ強瀹冧滑鎷ユ湁DLL鐨勫嚱鏁般傝繖鍙槸涓涓畝鍗曠殑if璇彞錛涘鏋滃叾涓竴涓瓑浜嶯ULL錛屼綘蹇呴渶濡傚墠鎵榪伴噴鏀懼簱銆?/p>

涓鏃﹀嚱鏁版寚閽堟嫢鏈塂LL鐨勫嚱鏁幫紝浣犵幇鍦ㄥ氨鍙互浣跨敤瀹冧滑浜嗭紝浣嗘槸榪欓噷鏈変竴涓渶瑕佹敞鎰忕殑鍦版柟錛氫綘涓嶈兘浣跨敤鍑芥暟鐨勫疄闄呭悕縐幫紱浣犲繀闇浣跨敤鍑芥暟鎸囬拡鏉ヨ皟鐢ㄥ畠浠傚湪閭d互鍚庯紝鎵鏈変綘闇瑕佸仛鐨勬槸閲婃斁搴撳姝よ屽凡銆?/p>

妯″潡鍙ユ焺

榪涚▼涓殑姣忎釜DLL妯″潡琚叏灞鍞竴鐨?2瀛楄妭鐨凥INSTANCE鍙ユ焺鏍囪瘑銆傝繘紼嬭嚜宸辮繕鏈変竴涓狧INSTANCE鍙ユ焺銆傛墍鏈夎繖浜涙ā鍧楀彞鏌勯兘鍙湁鍦ㄧ壒瀹氱殑榪涚▼鍐呴儴鏈夋晥錛屽畠浠唬琛ㄤ簡DLL鎴朎XE妯″潡鍦ㄨ繘紼嬭櫄鎷熺┖闂翠腑鐨勮搗濮嬪湴鍧銆傚湪Win32涓紝HINSTANCE鍜孒MODULE鐨勫兼槸鐩稿悓鐨勶紝榪欎釜涓ょ綾誨瀷鍙互鏇挎崲浣跨敤銆傝繘紼嬫ā鍧楀彞鏌勫嚑涔庢繪槸絳変簬0x400000錛岃孌LL妯″潡鐨勫姞杞藉湴鍧鐨勭己鐪佸彞鏌勬槸0x10000000銆傚鏋滅▼搴忓悓鏃朵嬌鐢ㄤ簡鍑犱釜DLL妯″潡錛屾瘡涓涓兘浼氭湁涓嶅悓鐨凥INSTANCE鍊箋傝繖鏄洜涓哄湪鍒涘緩DLL鏂囦歡鏃舵寚瀹氫簡涓嶅悓鐨勫熀鍦板潃錛屾垨鑰呮槸鍥犱負鍔犺澆紼嬪簭瀵笵LL浠g爜榪涜浜嗛噸瀹氫綅銆?br>妯″潡鍙ユ焺瀵逛簬鍔犺澆璧勬簮鐗瑰埆閲嶈銆俉in32 鐨凢indResource鍑芥暟涓甫鏈変竴涓狧INSTANCE鍙傛暟銆侲XE鍜孌LL閮芥湁鍏惰嚜宸辯殑璧勬簮銆傚鏋滃簲鐢ㄧ▼搴忛渶瑕佹潵鑷簬DLL鐨勮祫婧愶紝灝卞皢姝ゅ弬鏁版寚瀹氫負DLL鐨勬ā鍧楀彞鏌勩傚鏋滈渶瑕丒XE鏂囦歡涓寘鍚殑璧勬簮錛屽氨鎸囧畾EXE鐨勬ā鍧楀彞鏌勩?br>浣嗘槸鍦ㄤ嬌鐢ㄨ繖浜涘彞鏌勪箣鍓嶅瓨鍦ㄤ竴涓棶棰橈紝浣犳庢牱寰楀埌瀹冧滑鍛紵濡傛灉闇瑕佸緱鍒癊XE妯″潡鍙ユ焺錛岃皟鐢ㄥ甫鏈塏ull鍙傛暟鐨刉in32鍑芥暟GetModuleHandle錛涘鏋滈渶瑕丏LL妯″潡鍙ユ焺錛屽氨璋冪敤浠LL鏂囦歡鍚嶄負鍙傛暟鐨刉in32鍑芥暟GetModuleHandle銆?/p>

搴旂敤紼嬪簭鎬庢牱鎵懼埌DLL鏂囦歡

濡傛灉搴旂敤紼嬪簭浣跨敤LoadLibrary鏄懼紡閾炬帴錛岄偅涔堝湪榪欎釜鍑芥暟鐨勫弬鏁頒腑鍙互鎸囧畾DLL鏂囦歡鐨勫畬鏁磋礬寰勩傚鏋滀笉鎸囧畾璺緞錛屾垨鏄繘琛岄殣寮忛摼鎺ワ紝Windows灝嗛伒寰笅闈㈢殑鎼滅儲欏哄簭鏉ュ畾浣岲LL錛?br>1錛?鍖呭惈EXE鏂囦歡鐨勭洰褰曪紝
2錛?榪涚▼鐨勫綋鍓嶅伐浣滅洰褰曪紝
3錛?Windows緋葷粺鐩綍錛?br>4錛?Windows鐩綍錛?br>5錛?鍒楀湪Path鐜鍙橀噺涓殑涓緋誨垪鐩綍銆?br>榪欓噷鏈変竴涓緢瀹規槗鍙戠敓閿欒鐨勯櫡闃便傚鏋滀綘浣跨敤VC錛嬶紜榪涜欏圭洰寮鍙戯紝騫朵笖涓篋LL妯″潡涓撻棬鍒涘緩浜嗕竴涓」鐩紝鐒跺悗灝嗙敓鎴愮殑DLL鏂囦歡鎷瘋礉鍒扮郴緇熺洰褰曚笅錛屼粠搴旂敤紼嬪簭涓皟鐢―LL妯″潡銆傚埌鐩墠涓烘錛屼竴鍒囨甯搞傛帴涓嬫潵瀵笵LL妯″潡鍋氫簡涓浜涗慨鏀瑰悗閲嶆柊鐢熸垚浜嗘柊鐨凞LL鏂囦歡錛屼絾浣犲繕璁板皢鏂扮殑DLL鏂囦歡鎷瘋礉鍒扮郴緇熺洰褰曚笅銆備笅涓嬈″綋浣犺繍琛屽簲鐢ㄧ▼搴忔椂錛屽畠浠嶅姞杞戒簡鑰佺増鏈殑DLL鏂囦歡錛岃繖鍙褰撳績錛?/p>

璋冭瘯DLL紼嬪簭

Microsoft 鐨刅C錛嬶紜鏄紑鍙戝拰嫻嬭瘯DLL鐨勬湁鏁堝伐鍏鳳紝鍙渶浠嶥LL欏圭洰涓繍琛岃皟璇曠▼搴忓嵆鍙傚綋浣犵涓嬈¤繖鏍鋒搷浣滄椂錛岃皟璇曠▼搴忎細鍚戜綘璇㈤棶EXE鏂囦歡鐨勮礬寰勩傛鍚庢瘡嬈″湪璋冭瘯紼嬪簭涓繍琛孌LL鏃訛紝璋冭瘯紼嬪簭浼氳嚜鍔ㄥ姞杞借EXE鏂囦歡銆傜劧鍚庤EXE鏂囦歡鐢ㄤ笂闈㈢殑鎼滅儲搴忓垪鍙戠幇DLL鏂囦歡錛岃繖鎰忓懗鐫浣犲繀欏昏緗甈ath鐜鍙橀噺璁╁叾鍖呭惈DLL鏂囦歡鐨勭鐩樿礬寰勶紝鎴栬呬篃鍙互灝咲LL鏂囦歡鎷瘋礉鍒版悳绱㈠簭鍒椾腑鐨勭洰褰曡礬寰勪笅銆?br>鎴栬呭綋浣犺皟璇旹XE紼嬪簭鏃訛紝鍦≒roject Setting涓紝灝咲ebug閫夐」鍗′腑鐨凜ategory璁劇疆涓篈dditional DLLs銆傚氨鍙互鍚屾椂璋冭瘯EXE鍜屽畠璋冪敤鐨凞LL錛堝綋鐒訛紝浣犻渶瑕佹湁DLL鐨勬簮浠g爜錛変簡銆?br>   



Saga 2009-07-20 14:27 鍙戣〃璇勮
]]>
DLL鍏ラ棬嫻呮瀽錛?錛夆斺斿浣曞緩绔婦LLhttp://www.shnenglu.com/suiaiguo/archive/2009/07/20/90619.htmlSagaSagaMon, 20 Jul 2009 05:49:00 GMThttp://www.shnenglu.com/suiaiguo/archive/2009/07/20/90619.htmlhttp://www.shnenglu.com/suiaiguo/comments/90619.htmlhttp://www.shnenglu.com/suiaiguo/archive/2009/07/20/90619.html#Feedback1http://www.shnenglu.com/suiaiguo/comments/commentRss/90619.htmlhttp://www.shnenglu.com/suiaiguo/services/trackbacks/90619.html
   鍔ㄦ侀摼鎺ュ簱錛圖LL錛夋槸浠嶤璇█鍑芥暟搴撳拰Pascal搴撳崟鍏冪殑姒傚康鍙戝睍鑰屾潵鐨勩傛墍鏈夌殑C璇█鏍囧噯搴撳嚱鏁伴兘瀛樻斁鍦ㄦ煇涓鍑芥暟搴撲腑銆傚湪閾炬帴搴旂敤紼嬪簭鐨勮繃紼嬩腑錛岄摼鎺ュ櫒浠庡簱鏂囦歡涓嫹璐濈▼搴忚皟鐢ㄧ殑鍑芥暟浠g爜錛屽茍鎶婅繖浜涘嚱鏁頒唬鐮佹坊鍔犲埌鍙墽琛屾枃浠朵腑銆傝繖縐嶆柟娉曞悓鍙妸鍑芥暟鍌ㄥ瓨鍦ㄥ凡緙栬瘧鐨凮BJ鏂囦歡涓浉姣旀洿鏈夊埄浜庝唬鐮佺殑閲嶇敤銆備絾闅忕潃Windows榪欐牱鐨勫浠誨姟鐜鐨勫嚭鐜幫紝鍑芥暟搴撶殑鏂規硶鏄懼緱榪囦簬绱禈銆傚鏋滀負浜嗗畬鎴愬睆騫曡緭鍑恒佹秷鎭鐞嗐佸唴瀛樼鐞嗐佸璇濇絳夋搷浣滐紝姣忎釜紼嬪簭閮戒笉寰椾笉鎷ユ湁鑷繁鐨勫嚱鏁幫紝閭d箞Windows紼嬪簭灝嗗彉寰楅潪甯稿簽澶с俉indows鐨勫彂灞曡姹傚厑璁稿悓鏃惰繍琛岀殑鍑犱釜紼嬪簭鍏變韓涓緇勫嚱鏁扮殑鍗曚竴鎷瘋礉銆傚姩鎬侀摼鎺ュ簱灝辨槸鍦ㄨ繖縐嶆儏鍐典笅鍑虹幇鐨勩傚姩鎬侀摼鎺ュ簱涓嶇敤閲嶅緙栬瘧鎴栭摼鎺ワ紝涓鏃﹁鍏ュ唴瀛橈紝DLL鍑芥暟鍙互琚郴緇熶腑鐨勪換浣曟鍦ㄨ繍琛岀殑搴旂敤紼嬪簭杞歡鎵浣跨敤錛岃屼笉蹇呭啀灝咲LL鍑芥暟鐨勫彟涓鎷瘋礉瑁呭叆鍐呭瓨銆?br>
   涓嬮潰鎴戜滑涓姝ヤ竴姝ユ潵寤虹珛涓涓狣LL銆?br>
   涓銆佸緩绔嬩竴涓狣LL宸ョ▼
   鏂板緩涓涓伐紼嬶紝閫夋嫨Win32 鎺у埗鍙伴」鐩紙Win32 Console Application錛夛紝騫朵笖鍦ㄥ簲鐢ㄧ▼搴忚緗爣絳撅紙the advanced tab錛変笂錛岄夋嫨DLL鍜岀┖欏圭洰閫夐」銆?br>
   浜屻佸0鏄庡鍑哄嚱鏁?br>   榪欓噷鏈変袱縐嶆柟娉曞0鏄庡鍑哄嚱鏁幫細涓縐嶆槸閫氳繃浣跨敤__declspec(dllexport)錛屾坊鍔犲埌闇瑕佸鍑虹殑鍑芥暟鍓嶏紝榪涜澹版槑錛涘彟澶栦竴縐嶅氨鏄氳繃妯″潡瀹氫箟鏂囦歡錛圡odule-Definition File鍗?DEF錛夋潵榪涜澹版槑銆?br>   絎竴縐嶆柟娉曪紝寤虹珛澶存枃浠禗LLSample.h錛屽湪澶存枃浠朵腑錛屽闇瑕佸鍑虹殑鍑芥暟榪涜澹版槑銆?
#ifndef _DLL_SAMPLE_H
#define _DLL_SAMPLE_H

// 濡傛灉瀹氫箟浜咰++緙栬瘧鍣紝閭d箞澹版槑涓篊閾炬帴鏂瑰紡
#ifdef __cplusplus
extern "C" {
#endif

// 閫氳繃瀹忔潵鎺у埗鏄鍏ヨ繕鏄鍑?/span>
#ifdef _DLL_SAMPLE
#define DLL_SAMPLE_API __declspec(dllexport)
#else
#define DLL_SAMPLE_API __declspec(dllimport)
#endif

// 瀵煎嚭/瀵煎叆鍑芥暟澹版槑
DLL_SAMPLE_API void TestDLL(int);

#undef DLL_SAMPLE_API

#ifdef __cplusplus
}

#endif

#endif

   榪欎釜澶存枃浠朵細鍒嗗埆琚獶LL鍜岃皟鐢―LL鐨勫簲鐢ㄧ▼搴忓紩鍏ワ紝褰撹DLL寮曞叆鏃訛紝鍦―LL涓畾涔塤DLL_SAMPLE瀹忥紝榪欐牱灝變細鍦―LL妯″潡涓0鏄庡嚱鏁頒負瀵煎嚭鍑芥暟錛涘綋琚皟鐢―LL鐨勫簲鐢ㄧ▼搴忓紩鍏ユ椂錛屽氨娌℃湁瀹氫箟_DLL_SAMPLE錛岃繖鏍峰氨浼氬0鏄庡ご鏂囦歡涓殑鍑芥暟涓轟粠DLL涓殑瀵煎叆鍑芥暟銆?nbsp;
  
   絎簩縐嶆柟娉曪細妯″潡瀹氫箟鏂囦歡鏄竴涓湁鐫.def鏂囦歡鎵╁睍鍚嶇殑鏂囨湰鏂囦歡銆傚畠琚敤浜庡鍑轟竴涓狣LL鐨勫嚱鏁幫紝鍜宊_declspec(dllexport)寰堢浉浼鹼紝浣嗘槸.def鏂囦歡騫朵笉鏄疢icrosoft瀹氫箟鐨勩備竴涓?def鏂囦歡涓彧鏈変袱涓繀闇鐨勯儴鍒嗭細LIBRARY 鍜?EXPORTS銆?
LIBRARY DLLSample
DESCRIPTION 
"my simple DLL"
EXPORTS
        TestDLL @
1  錛汙1琛ㄧず榪欐槸絎竴涓鍑哄嚱鏁?br>
   絎竴琛岋紝''LIBRARY''鏄竴涓繀闇鐨勯儴鍒嗐傚畠鍛婅瘔閾炬帴鍣紙linker錛夊浣曞懡鍚嶄綘鐨凞LL銆備笅闈㈣鏍囪瘑涓?'DESCRIPTION''鐨勯儴鍒嗗茍涓嶆槸蹇呴渶鐨勩傝璇彞灝嗗瓧絎︿覆鍐欏叆 .rdata 鑺傦紝瀹冨憡璇変漢浠皝鍙兘浣跨敤榪欎釜DLL錛岃繖涓狣LL鍋氫粈涔堟垨瀹冧負浜嗕粈涔堬紙瀛樺湪錛夈傚啀涓嬮潰鐨勯儴鍒嗘爣璇嗕負''EXPORTS''鏄彟涓涓繀闇鐨勯儴鍒嗭紱榪欎釜閮ㄥ垎浣垮緱璇ュ嚱鏁板彲浠ヨ鍏跺畠搴旂敤紼嬪簭璁塊棶鍒板茍涓斿畠鍒涘緩涓涓鍏ュ簱銆傚綋浣犵敓鎴愯繖涓」鐩椂錛屼笉浠呮槸涓涓?dll鏂囦歡琚垱寤猴紝鑰屼笖涓涓枃浠舵墿灞曞悕涓?lib鐨勫鍑哄簱涔熻鍒涘緩浜嗐傞櫎浜嗗墠闈㈢殑閮ㄥ垎浠ュ錛岃繖閲岃繕鏈夊叾瀹冨洓涓儴鍒嗘爣璇嗕負錛歂AME, STACKSIZE, SECTIONS, 鍜?VERSION銆傚彟澶栵紝涓涓垎鍙?;)寮濮嬩竴涓敞瑙o紝濡傚悓''//''鍦–++涓竴鏍楓傚畾涔変簡榪欎釜鏂囦歡涔嬪悗錛屽ご鏂囦歡涓殑__declspec(dllexport)灝變笉闇瑕佸0鏄庝簡銆?br>
   涓夈佺紪鍐橠llMain鍑芥暟鍜屽鍑哄嚱鏁?br>   DllMain鍑芥暟鏄疍LL妯″潡鐨勯粯璁ゅ叆鍙g偣銆傚綋Windows鍔犺澆DLL妯″潡鏃惰皟鐢ㄨ繖涓鍑芥暟銆傜郴緇熼鍏堣皟鐢ㄥ叏灞瀵硅薄鐨勬瀯閫犲嚱鏁幫紝鐒跺悗璋冪敤鍏ㄥ眬鍑芥暟DLLMain銆侱LLMain鍑芥暟涓嶄粎鍦ㄥ皢DLL閾炬帴鍔犺澆鍒拌繘紼嬫椂琚皟鐢紝鍦―LL妯″潡涓庤繘紼嬪垎紱繪椂錛堜互鍙婂叾瀹冩椂鍊欙級涔熻璋冪敤銆?
#include "stdafx.h"
#define _DLL_SAMPLE

#ifndef _DLL_SAMPLE_H
#include 
"DLLSample.h"
#endif

#include 
"stdio.h"

//APIENTRY澹版槑DLL鍑芥暟鍏ュ彛鐐?/span>
BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
銆銆
case DLL_PROCESS_ATTACH:
銆銆
case DLL_THREAD_ATTACH:
銆銆
case DLL_THREAD_DETACH:
銆銆
case DLL_PROCESS_DETACH:
銆銆銆
break;
銆}

return TRUE;
}


void TestDLL(int arg)
{
  printf(
"DLL output arg %d\n", arg);
}
   濡傛灉紼嬪簭鍛樻病鏈変負DLL妯″潡緙栧啓涓涓狣LLMain鍑芥暟錛岀郴緇熶細浠庡叾瀹冭繍琛屽簱涓紩鍏ヤ竴涓笉鍋氫換浣曟搷浣滅殑緙虹渷DLLMain鍑芥暟鐗堟湰銆傚湪鍗曚釜綰跨▼鍚姩鍜岀粓姝㈡椂錛孌LLMain鍑芥暟涔熻璋冪敤銆?br>   鐒跺悗錛孎7緙栬瘧錛屽氨寰楀埌涓涓狣LL浜嗐?br>   

Saga 2009-07-20 13:49 鍙戣〃璇勮
]]>
Windows娑堟伅鏈哄埗姒傝堪http://www.shnenglu.com/suiaiguo/archive/2009/07/18/90412.htmlSagaSagaSat, 18 Jul 2009 02:50:00 GMThttp://www.shnenglu.com/suiaiguo/archive/2009/07/18/90412.htmlhttp://www.shnenglu.com/suiaiguo/comments/90412.htmlhttp://www.shnenglu.com/suiaiguo/archive/2009/07/18/90412.html#Feedback0http://www.shnenglu.com/suiaiguo/comments/commentRss/90412.htmlhttp://www.shnenglu.com/suiaiguo/services/trackbacks/90412.html闃呰鍏ㄦ枃

Saga 2009-07-18 10:50 鍙戣〃璇勮
]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲国语精品自产拍在线观看| 美女视频黄免费的久久| 亚洲破处大片| 欧美在线影院| 午夜久久久久久| 欧美日韩国产黄| 欧美sm极限捆绑bd| 国内自拍一区| 香蕉久久国产| 亚洲欧美经典视频| 国产精品草莓在线免费观看| 亚洲国产网站| 亚洲另类自拍| 男女精品视频| 亚洲高清不卡在线| 91久久精品国产| 男同欧美伦乱| 亚洲国产成人久久综合| 最新成人av在线| 欧美va亚洲va国产综合| 亚洲第一精品在线| 亚洲人成在线观看网站高清| 欧美成人精品激情在线观看 | 欧美激情久久久| 红桃视频国产精品| 久久人人九九| 亚洲电影在线看| 亚洲精品国产系列| 欧美精品在线免费播放| 亚洲人成在线免费观看| 亚洲最新在线视频| 欧美午夜在线| 欧美亚洲网站| 久久免费视频一区| 亚洲激情国产精品| 欧美精品一区二区三区在线播放 | 国产精品日本精品| 亚洲欧美日韩国产综合| 久久久人成影片一区二区三区| 精品成人在线观看| 欧美国产先锋| 一本一本a久久| 久久久久91| 亚洲茄子视频| 国产精品久久久久久模特| 香蕉久久一区二区不卡无毒影院| 老司机午夜精品视频| 亚洲精品日韩在线观看| 国产精品成人aaaaa网站| 亚洲欧美另类国产| 欧美成人免费全部| 亚洲在线免费观看| 精品96久久久久久中文字幕无| 欧美激情精品久久久| 亚洲一二三四区| 蜜桃久久av| 一本色道88久久加勒比精品| 国产精品一区二区三区久久久| 久久久福利视频| 日韩一区二区福利| 裸体一区二区| 亚洲视频日本| 亚洲盗摄视频| 国产精品免费小视频| 免费观看一级特黄欧美大片| 亚洲一区三区在线观看| 欧美顶级少妇做爰| 欧美中文字幕视频在线观看| 亚洲精品视频在线观看网站| 国产精品三级久久久久久电影| 久久综合久久综合这里只有精品 | 欧美一区=区| 亚洲狼人综合| 欧美顶级艳妇交换群宴| 欧美亚洲自偷自偷| 一片黄亚洲嫩模| 亚洲风情亚aⅴ在线发布| 国产精品美女久久久免费| 欧美成人日本| 久久久久久网址| 午夜精品久久| aaa亚洲精品一二三区| 免费在线视频一区| 久久久久综合一区二区三区| 亚洲一区二区三区高清| 亚洲精品视频在线播放| 一区二区三区在线看| 国产婷婷色综合av蜜臀av | 欧美片网站免费| 麻豆freexxxx性91精品| 久久精品日产第一区二区三区| 亚洲婷婷国产精品电影人久久| 亚洲日本欧美| 亚洲国产成人av好男人在线观看| 老司机午夜精品视频| 久久久久国产一区二区| 久久av资源网| 久久国内精品视频| 久久精品一区二区国产| 久久aⅴ国产欧美74aaa| 欧美在线免费观看| 欧美中文在线视频| 久久福利毛片| 久久精品国产清自在天天线| 欧美一区二区三区日韩视频| 欧美一区成人| 久久精品亚洲一区二区三区浴池| 欧美自拍偷拍| 久久久久一区| 欧美www视频在线观看| 欧美国产综合视频| 亚洲国产成人一区| 日韩一级在线| 亚洲性感美女99在线| 午夜精品剧场| 久久久不卡网国产精品一区| 鲁大师成人一区二区三区| 欧美国产激情| 欧美色精品天天在线观看视频| 国产精品久久久久99| 国产精品一区二区三区久久| 国产在线欧美日韩| 亚洲黄一区二区| 亚洲色在线视频| 久久精品噜噜噜成人av农村| 女同一区二区| 亚洲精品中文字幕有码专区| 亚洲一级在线| 久久精品女人天堂| 欧美激情亚洲另类| 国产精品视频内| 在线看片成人| 亚洲小说欧美另类婷婷| 久久不见久久见免费视频1| 久久只精品国产| 亚洲精品乱码久久久久久久久| 亚洲欧美国产精品专区久久| 久久久久国产精品麻豆ai换脸| 欧美精品日韩一区| 国产日韩精品一区二区三区| 亚洲电影成人| 午夜精品在线| 亚洲国产成人午夜在线一区| 亚洲欧美激情视频| 欧美成人精品一区| 国产日韩在线一区| 99riav久久精品riav| 久久久久国产精品www| 亚洲精品国产日韩| 久久精品国产清自在天天线| 欧美日韩成人在线播放| 国产在线观看91精品一区| 在线视频精品一区| 欧美刺激午夜性久久久久久久| 亚洲午夜精品| 欧美黑人在线播放| 国产综合在线视频| 亚洲一区二区欧美日韩| 欧美激情精品久久久久久| 欧美亚洲视频| 欧美私人啪啪vps| 亚洲人成高清| 久久男人av资源网站| 亚洲一二三区精品| 欧美日韩1区| 亚洲精品美女在线| 美国三级日本三级久久99| 亚洲影院色在线观看免费| 欧美精品在线看| 亚洲韩国精品一区| 久久在线视频在线| 欧美呦呦网站| 国产日韩精品一区二区| 亚洲欧美韩国| 亚洲免费av电影| 欧美精品123区| 亚洲三级观看| 亚洲高清在线观看| 鲁鲁狠狠狠7777一区二区| 韩国v欧美v日本v亚洲v| 欧美中文字幕视频| 午夜精品一区二区三区在线视 | 亚洲欧美国产高清va在线播| 亚洲人成网站在线观看播放| 免费一级欧美片在线观看| 亚洲国产成人91精品| 噜噜噜躁狠狠躁狠狠精品视频| 欧美亚洲一级| 国产一区日韩欧美| 久热精品在线视频| 久久久蜜臀国产一区二区| 好看的亚洲午夜视频在线| 久久午夜国产精品| 久久亚洲精品伦理| 91久久精品美女高潮| 亚洲国产欧美久久| 欧美乱人伦中文字幕在线| 亚洲天堂成人| 亚洲欧美日韩国产另类专区| 国产欧美精品在线观看|