dll
bp2316.dll
函数
int _VI_FUNC bp2316_init (int COMPort, int baudRate, double timeoutseconds,
int blockCheck, int groupAddress, int userAddress,
int resetDevice, int *instrumentID);
int _VI_FUNC bp2316_meas_start (int instrumentID);
int _VI_FUNC bp2316_meas_read (int instrumentID, double *measuringValue,
char unit[]);
int _VI_FUNC bp2316_meas_stop (int instrumentID);
int _VI_FUNC bp2316_send_scpi (int instrumentID, char sendSCPIMessage[]);
int _VI_FUNC bp2316_receive_scpi (int instrumentID, char sendSCPIMessage[],
char instrumentAnswers[]);
int _VI_FUNC bp2316_close (int instrumentID);请问高手们C#中如何代码调用?自己写了一个,但是调用的时候报错“找不到指定模块”。
[DllImport("bp2316.dll")]
public extern static short bp2316_init(short COMPort, short baudRate, double timeoutseconds, short blockCheck, short groupAddress, short userAddress, short resetDevice, ref short instrumentID);
bp2316.dll
函数
int _VI_FUNC bp2316_init (int COMPort, int baudRate, double timeoutseconds,
int blockCheck, int groupAddress, int userAddress,
int resetDevice, int *instrumentID);
int _VI_FUNC bp2316_meas_start (int instrumentID);
int _VI_FUNC bp2316_meas_read (int instrumentID, double *measuringValue,
char unit[]);
int _VI_FUNC bp2316_meas_stop (int instrumentID);
int _VI_FUNC bp2316_send_scpi (int instrumentID, char sendSCPIMessage[]);
int _VI_FUNC bp2316_receive_scpi (int instrumentID, char sendSCPIMessage[],
char instrumentAnswers[]);
int _VI_FUNC bp2316_close (int instrumentID);请问高手们C#中如何代码调用?自己写了一个,但是调用的时候报错“找不到指定模块”。
[DllImport("bp2316.dll")]
public extern static short bp2316_init(short COMPort, short baudRate, double timeoutseconds, short blockCheck, short groupAddress, short userAddress, short resetDevice, ref short instrumentID);
public extern static short bp2316_init(short COMPort, short baudRate, double timeoutseconds, short blockCheck, short groupAddress, short userAddress, short resetDevice, ref short instrumentID);再调用试一下,,
如果是release,那么复制到release目录下.
public extern static short bp2316_init(short COMPort, short baudRate, double timeoutseconds, short blockCheck, short groupAddress, short userAddress, short resetDevice, ref short instrumentID);如果还是包这个问题,你用VC6工具,DEPENDS.EXE,打开DLL_MD5.dll,看看这个函数是否真正存在?
用工具查看了一下函数是有的,但这个DLL还引用了instrup.dll。可能是这个原因报错吧。
另外看看VI_FUNC 是定义的什么调用约定。你要做相应的修改。
对,所有依赖的动态库都放在同一目录里。