📄 building dlls in labview 6.mht
字号:
src=3D"http://zone.ni.com/images/devzone/us/printer_icon.gif"=20
border=3D0></A> <A=20
=
href=3D"http://zone.ni.com/devzone/conceptd.nsf/webmain/5DF85B448EB081D88=
62568FF006A0B20?opendocument&node=3Ddz00000_us">Print=20
this Page</A><BR><!--startindex-->
<P><FONT size=3D2>You can use the LabVIEW 6.x Application Builder =
to create=20
shared libraries (DLLs) from VIs, so you can call the VIs in the =
shared=20
library using text-based programming languages, such as =
LabWindows/CVI,=20
Microsoft Visual C++, and Microsoft Visual =
Basic.</FONT><BR><BR><B><FONT=20
size=3D2>Note: </FONT></B><FONT size=3D2>The LabVIEW Professional =
Development=20
System includes the Application Builder. If you use the LabVIEW =
Base=20
Package or Full Development System, you can purchase the =
Application=20
Builder separately, using the related links =
below.</FONT><BR><BR><FONT=20
size=3D2>Refer to the LabVIEW Help, available by selecting =
</FONT><B><FONT=20
size=3D2>Help=BBContents and Index</FONT></B><FONT size=3D2>, for =
more=20
information about building shared libraries, including =
descriptions of=20
fields in the dialog boxes shown below.</FONT></P><STRONG>Table of =
Contents:</STRONG>=20
<UL type=3Ddisc>
<LI type=3Ddisc><A class=3Dtoc=20
=
href=3D"http://zone.ni.com/devzone/conceptd.nsf/webmain/5DF85B448EB081D88=
62568FF006A0B20?opendocument&node=3DDZ52048_US#1">Creating=20
a VI</A>=20
<LI type=3Ddisc><A class=3Dtoc=20
=
href=3D"http://zone.ni.com/devzone/conceptd.nsf/webmain/5DF85B448EB081D88=
62568FF006A0B20?opendocument&node=3DDZ52048_US#2">Creating=20
a DLL in LabVIEW</A>=20
<LI type=3Ddisc><A class=3Dtoc=20
=
href=3D"http://zone.ni.com/devzone/conceptd.nsf/webmain/5DF85B448EB081D88=
62568FF006A0B20?opendocument&node=3DDZ52048_US#3">Calling=20
a LabVIEW DLL</A></LI></UL>
<UL></UL>
<OL></OL>
<DIV></DIV>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR>
<TD class=3Dlinebuffer vAlign=3Dbottom colSpan=3D2>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%" =
border=3D0>
<TBODY>
<TR>
<TD class=3Dtablegbg><IMG height=3D1 alt=3D""=20
src=3D"http://zone.ni.com/images/global/us/invis.gif" =
width=3D10=20
border=3D0></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD class=3Dsubheader> </TD>
<TD class=3Dsubheader width=3D"100%"><A name=3D1>Creating a=20
VI</A><BR></TD></TR></TBODY></TABLE><BR><FONT size=3D2>Complete =
the=20
following steps to create a VI that converts a temperature from =
degrees=20
Fahrenheit to degrees Celsius, which you easily can call from =
text-based=20
programming languages.</FONT><BR><BR><FONT size=3D2>
<OL>
<LI>Use the following equation to create a VI to perform the=20
conversion.<BR></FONT>
<BLOCKQUOTE>Deg C =3D (Deg F - 32) / 1.8</BLOCKQUOTE>The block =
diagram and=20
front panel should appears as follows.<BR><BR><IMG height=3D283=20
=
src=3D"http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a900=
6ffe76/5df85b448eb081d8862568ff006a0b20/Content1/0.2A6?OpenElement&Fi=
eldElemFormat=3Dgif"=20
width=3D447> <BR><IMG height=3D278=20
=
src=3D"http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a900=
6ffe76/5df85b448eb081d8862568ff006a0b20/Content1/0.4FB2?OpenElement&F=
ieldElemFormat=3Dgif"=20
width=3D441>=20
<LI>Assign the control and indicator to terminals in the =
connector pane.=20
This step is necessary to create the DLL. Refer to the LabVIEW =
Help,=20
available by selecting <B>Help=BBContents and Index</B>, for =
more=20
information about assigning controls and indicators to=20
terminals.<BR><BR>
<LI>Save and close the VI, because the VI cannot be in memory =
when you=20
create the DLL.</LI></OL>
<UL></UL>
<OL></OL>
<DIV></DIV>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR>
<TD class=3Dlinebuffer vAlign=3Dbottom colSpan=3D2>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%" =
border=3D0>
<TBODY>
<TR>
<TD class=3Dtablegbg><IMG height=3D1 alt=3D""=20
src=3D"http://zone.ni.com/images/global/us/invis.gif" =
width=3D10=20
border=3D0></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD class=3Dsubheader> </TD>
<TD class=3Dsubheader width=3D"100%"><A name=3D2>Creating a =
DLL in=20
LabVIEW</A><BR></TD></TR></TBODY></TABLE><BR><FONT =
size=3D2>Complete the=20
following steps to create a DLL from the VI you =
built.</FONT><BR><FONT=20
size=3D2>
<OL>
<LI>Open a new VI and select </FONT><B>Tools=BBBuild Application =
or Shared=20
Library (DLL)</B>.<BR><BR>
<LI>Select <B>Shared Library (DLL)</B> in the <B>Build =
Target</B> field=20
and specify a name for the DLL and destination and support=20
directories.<BR><BR><IMG height=3D400=20
=
src=3D"http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a900=
6ffe76/5df85b448eb081d8862568ff006a0b20/Content2/0.202?OpenElement&Fi=
eldElemFormat=3Dgif"=20
width=3D622>=20
<LI>Click the <B>Source Files</B> tab, click the <B>Add Exported =
VI</B>=20
button, and double-click your main VI. The following dialog box=20
appears.<BR><BR>
<LI>Select the input parameter (DegF) and click the plus (+) =
button to=20
add the input to the DLL. Also, select whether you want to pass =
the=20
parameter as a value or a pointer to value. In this case, select =
<B>Value</B> in the <B>Pass By</B> field. The function prototype =
changes=20
at the bottom of the dialog box.<BR><BR><IMG height=3D390=20
=
src=3D"http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a900=
6ffe76/5df85b448eb081d8862568ff006a0b20/Content2/0.8940?OpenElement&F=
ieldElemFormat=3Dgif"=20
width=3D526>=20
<LI>Repeat the previous step for the other parameters, such as =
the Deg C=20
output. This output is passed as a pointer by =
default.<BR><BR><IMG=20
height=3D390=20
=
src=3D"http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a900=
6ffe76/5df85b448eb081d8862568ff006a0b20/Content2/1.37C4?OpenElement&F=
ieldElemFormat=3Dgif"=20
width=3D526>=20
<LI>You also can select any of your output parameters as the =
return=20
value of your function. The following function returns the DegC =
64 bit=20
floating-point number instead of a void. Therefore, you have two =
options=20
for generating outputs from your function. You can add it as an =
output=20
parameter or return it. The following function does =
both.<BR><BR><IMG=20
height=3D401=20
=
src=3D"http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a900=
6ffe76/5df85b448eb081d8862568ff006a0b20/Content2/2.4AB2?OpenElement&F=
ieldElemFormat=3Dgif"=20
width=3D621>=20
<LI>Click the <B>OK</B> button in the <B>Define VI Prototype</B> =
dialog=20
box.<BR><BR>
<LI>Click the <B>Build</B> button in the <B>Build Application or =
Shared=20
Library (DLL)</B> dialog box to create the DLL. LabVIEW creates =
the DLL=20
in the destination directory along with a header and library =
file. In=20
this example, the destination directory is =
c:\temp\app.<BR><BR><IMG=20
height=3D402=20
=
src=3D"http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a900=
6ffe76/5df85b448eb081d8862568ff006a0b20/Content2/4.2F28?OpenElement&F=
ieldElemFormat=3Dgif"=20
width=3D622> </LI></OL>
<UL></UL>
<OL></OL>
<DIV></DIV>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR>
<TD class=3Dlinebuffer vAlign=3Dbottom colSpan=3D2>
<TABLE cellSpacing=3D0 cellPadding=3D0 width=3D"100%" =
border=3D0>
<TBODY>
<TR>
<TD class=3Dtablegbg><IMG height=3D1 alt=3D""=20
src=3D"http://zone.ni.com/images/global/us/invis.gif" =
width=3D10=20
border=3D0></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD class=3Dsubheader> </TD>
<TD class=3Dsubheader width=3D"100%"><A name=3D3>Calling a =
LabVIEW=20
DLL</A><BR></TD></TR></TBODY></TABLE><BR><FONT =
size=3D2>Refer to the=20
following links for examples of how you can call this DLL from =
Microsoft=20
Visual Basic, Microsoft Visual C++., and =
LabWindows/CVI</FONT><FONT=20
size=3D2>.</FONT>
<UL></UL>
<OL></OL>
<DIV></DIV>
<BLOCKQUOTE><SPAN class=3Dtitle3>See Also: </SPAN><BR><A=20
=
href=3D"http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&4=
303F9807BFE234486256906007259EF">Calling=20
a DLL from Microsoft Visual Basic That Was Generated By LabVIEW=20
6i</A><BR><A=20
=
href=3D"http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&F=
CF8C388FD07522B862569060074F0CB">Calling=20
a DLL from Microsoft Visual C++ that Was Generated by LabVIEW=20
6i</A><BR></BLOCKQUOTE><BR><B><FONT size=3D2>Related=20
Links:</FONT></B><BR><FONT size=3D2><A=20
=
href=3D"http://sine.ni.com/apps/we/nioc.vp?cid=3D10731&lang=3DUS">Lab=
VIEW=20
Application Builder for Windows</A><BR><A=20
=
href=3D"http://sine.ni.com/apps/we/nioc.vp?cid=3D10732&lang=3DUS">Lab=
VIEW=20
Application Builder for Mac OS</A><BR><A=20
=
href=3D"http://sine.ni.com/apps/we/nioc.vp?cid=3D10733&lang=3DUS">Lab=
VIEW=20
Application Builder for Sun Solaris 2</A><BR><A=20
=
href=3D"http://sine.ni.com/apps/we/nioc.vp?cid=3D10734&lang=3DUS">Lab=
VIEW=20
Application Builder for HP-UX</A><BR><A=20
=
href=3D"http://sine.ni.com/apps/we/nioc.vp?cid=3D10735&lang=3DUS">Lab=
VIEW=20
Application Builder for Linux</A><BR></FONT><!--stopindex--><BR><A =
=
href=3D"http://zone.ni.com/devzone/conceptd.nsf/webmain/5DF85B448EB081D88=
62568FF006A0B20?opendocument&node=3Ddz00000_us"><IMG=20
src=3D"http://zone.ni.com/images/devzone/us/printer_icon.gif"=20
border=3D0></A> <A=20
=
href=3D"http://zone.ni.com/devzone/conceptd.nsf/webmain/5DF85B448EB081D88=
62568FF006A0B20?opendocument&node=3Ddz00000_us">Print=20
this Page</A><BR><!--startindex--><!---->
<SCRIPT language=3Djavascript>=0A=
function comments() {=0A=
var com_URL =3D =
"/devzone/dzcomments.nsf/userresponse?openform&id=3D5DF85B448EB081D886256=
8FF006A0B20&type=3DCD&title=3DBuilding~DLLs~in~LabVIEW~6.x&location=3Ddev=
zone/conceptd.nsf&submit=3D&node=3DDZ52048_US";=0A=
window.location =3D com_URL;=0A=
}=0A=
</SCRIPT>
<A name=3Drank></FORM>
<TABLE class=3Dclearbg cellSpacing=3D0 cellPadding=3D0 width=3D367 =
align=3Dcenter=20
border=3D0>
<FORM class=3Dglobalbg name=3Dsuppfeed=20
=
action=3D/devzone/conceptd.nsf/webmain/5DF85B448EB081D8862568FF006A0B20?S=
aveDocument&node=3DDZ52048_US=20
method=3Dpost>
<TBODY>
<TR>
<TD vAlign=3Dtop noWrap width=3D90><SPAN=20
style=3D"FONT-SIZE: 8pt"><STRONG>Your =
Feedback!</STRONG></SPAN></TD>
<TD vAlign=3Dtop noWrap align=3Dmiddle colSpan=3D5><SPAN=20
style=3D"FONT-SIZE: 8pt"><IMG height=3D7 alt=3Dpoor=20
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -