在LabWindows/CVI中使用動態連結程式庫(DLL)檔的函式
主要軟體: LabWindows/CVI Development Systems>>Full Development System
主要軟體版本: 8.0.1
主要軟體修正版本:
次要軟體: N/A
問題: 我在 LabWindows/CVI 中該如何使用DLL
動態連結程式庫中的函式呢?
解答: 為了要使 LabWindows/CVI 知道您的程式碼如何連結到外部的DLL檔,您必須提供一個機制使得 LabWindows/CVI 知道要在何處尋找,其中一個方法為使用 DLL's import library
一個DLL檔與其對應的"匯入程式庫 ( import library )"必須要互相配合才能使 LabWindows/CVI 連結其函式呼叫至DLL定義。匯入程式庫( import library ) 的檔案名稱必須與其對應的DLL檔相同,除了其副檔名為.lib而不是.dll。
為了要使LabWindows/CVI 呼叫DLL中的函式,您必須要在LabWindows/CVI 的 project 中匯入DLL檔的"匯入程式庫 ( import library )",要做到這樣的事情,開啟您的 LabWindows/CVI 專案,選擇Edit » Add Files to Project » Library (*.lib) 瀏覽到您的"匯入程式庫( import library )" ,LabWindows/CVI 即會嘗試去在"匯入程式庫( import library )"中找到您的函式呼叫對應的函式,且"匯入程式庫( import library )" 會告訴 LabWindows/CVI 此函數在何處被定義。
如果DLL檔案的建立者沒有提供"匯入程式庫( import library )",您可以使用LabWindows/CVI幫您產生"匯入程式庫( import library )",但是您必須要有您DLL的header檔(.h),請參閱知識庫中有關於建立"匯入程式庫( import library )"的資訊
Creating Import Libraries for a DLL in LabWindows/CVI若您想要使用 import library 去呼叫您的DLL檔,請參閱
How Can I Access DLL Functions in a LabWindows/CVI Program Without Including the Import Library in the Project?
相關連結:
附加檔案:
報告日期: 07/27/2000
最後更新: 10/08/2007
文件偏號: 1ZQDQPY5
Other Support Options
Ask the NI Community
Collaborate with other users in our discussion forums
Request Support from an Engineer
A valid service agreement may be required, and support options vary by country.