工控机的CAN卡,通过PCI BUS,除了有dll文件外,还有 CANbusApi.lib,WinIo.sys文件。
对方给出了在vc下加载这2个文件的方式,如下:
==================
1. Copy CANbusAPI to your project:
Copy the 4 files “CANbusAPI.dll” “CANbusAPI.lib” “CANbusAPI.h”
“WinIo.sys” to your project folder. And add the code in your source
file which use the functions of CANbusAPI.dll
#include “CANbusAPI.h”
2. Include CANBUSAPI library to your project:
There are two ways to include library (you just need to choice one):
a. on your IDE (ex. VS2005 or VS 2008…), fill “CANbusAPI.lib” to
the editor of “Project -> Properties -> Configuration Properties ->
Linker -> Input -> Additional Dependencies”
Fill library setting at Project Setting
b. Add the following line to your header file of project, which use
the functions of CANbusAPI.dll in source file.
#pragma comment (lib, “CANbusAPI.lib”)
================
在LabVIEW 中仅能加载dll文件。目前无法对设备的硬件端口初始化操作。而别人用vc操作的程序,加载了 CANbusApi.lib,WinIo.sys文件后,可以正常操作硬件。
问题:1 lv能加在 CANbusApi.lib,WinIo.sys文件 吗?
2 若不能,是否需要 将 CANbusApi.lib,WinIo.sys文件 做成驱动文件安装在windows,然后再调用?
1. No.
2. LabVIEW can only call a dll. So do whatever you can to create a new dll (which includes all the features in the .lib and winlo.sys), and call it in LabVIEW.