Yuav Tsim Cov Tsev Qiv Ntawv Dll Li Cas

Cov txheej txheem:

Yuav Tsim Cov Tsev Qiv Ntawv Dll Li Cas
Yuav Tsim Cov Tsev Qiv Ntawv Dll Li Cas

Video: Yuav Tsim Cov Tsev Qiv Ntawv Dll Li Cas

Video: Yuav Tsim Cov Tsev Qiv Ntawv Dll Li Cas
Video: yuav tau tsim kho tus kheej lub neej thiaj yuav vam meej tau 2024, Hlis ntuj nqeg
Anonim

DLL yog ib daim ntawv khaws cia hauv cov ntaub ntawv nrog.dll ncua ntxiv. Ib qho ntawm daim code tuaj yeem siv los ntawm lwm cov ntawv thov, tab sis lub tsev qiv ntawv tsis yog ib daim ntawv thov nws tus kheej. Hauv cov ntsiab lus, cov tsev qiv ntawv txuas rau sab nrauv yog cov kev sib sau ua ke ntawm cov haujlwm. Txawm li cas los xij, cov tsev qiv ntawv zoo li no muaj cov lej ntawm peculiarities - piv txwv li, yog tias qee cov ntawv thov raug tib lub sijhawm ua haujlwm hauv lub system thiab lawv siv cov haujlwm nyob hauv tib lub DLL, tom qab ntawd tsuas yog ib lub tsev qiv ntawv yuav nyob tas mus li hauv lub cim xeeb - cov qauv no ua kom muaj kev siv nyiaj txiag ntawm kev nco.

Yuav tsim cov tsev qiv ntawv dll li cas
Yuav tsim cov tsev qiv ntawv dll li cas

Tsim nyog

Compiler

Cov Lus Qhia

Kauj ruam 1

Tsim qhov project tshiab hauv lub compiler los ntawm kev xaiv los ntawm cov khoom siv ntawv "Cov Ntaub Ntawv", "Tshiab", "Library dll". Ib qhov project yuav tsim nrog cov ntsiab lus hauv qab no: "intWINAPI_Dll_Entry_Point (HINSTANCE_hinst_unsignedlong {rov qab 1;}".

Kauj ruam 2

Tsis tas li ntawd, yuav muaj lub ntsiab lus ntev lus ceeb toom hais tias kom lub tsev qiv ntawv ua haujlwm, ntau tus.dlls yuav tsum tau muab, muab qhov xwm txheej ntawm chav kawm String tau siv. Txhawm rau import thiab tawm los ntawm DLL, koj yuav tsum thov cov _import thiab _export modifiers, feem. Ntxiv rau, nyob ntawm qhov version ntawm compiler, nws raug tso cai siv cov lus tshiab _delspec () nrog rau dllimport thiab dllexport tsis, feem.

Kauj ruam 3

Txhawm rau xa cov haujlwm ntawm lub tsev qiv ntawv, koj yuav xav tau ib kab ntawv sau nrog cov lus piav qhia ntawm _delspec (dllexport) rau lub luag haujlwm muab xa tawm; txhawm rau ntshuam lub luag haujlwm rau hauv cov ntawv thov, tus neeg siv yuav xav tau teeb tsa cov ntawv zoo sib xws, tab sis nrog _delspec (dllimport) lus piav qhia, uas tuaj yeem ua rau tsis muaj kev ntxhov siab. Cov teeb meem no tuaj yeem daws tau yooj yim: ntxiv cov hauv qab no rau lub tsev qiv ntawv lub taub hau cov ntawv: “#ifdefined (BUILDDLL); #endif endif.

Kauj ruam 4

Sau qhov project no. Yog tias koj nias "Khiav", tom qab ntawd tom qab ua tiav kev tsim kho, lub compiler yuav tso lus qhia txog qhov ua tsis tau ntawm kev ua haujlwm. Daim ntawv thov hu xov tooj yuav tsum sau tam sim no. Hauv tib cov npe, tsim txoj haujlwm tshiab (Cov Ntaub Ntawv / NewApplication), muab ib lub pob hauv daim foos thiab tsim kom muaj OnClick handler.

Kauj ruam 5

Tom qab ntawd, txhua qhov tseem tshuav yog qhib qhov project thiab ntxiv.lib cov ntaub ntawv los ntawm cov phiaj xwm dhau los nrog DLL (nyem rau, "Ntxiv" cov khoom), thiab tom qab ntawd pib peb tes num.

Pom zoo: