07-22-2008 06:31 PM
08-05-2008 08:40 PM
Problems still exist in VC caller:
The VC caller can call RunDLL() fo dll correctly. But when I add MyDLLStdcallFunction and MyDLLCdeclFunction, the app could not be compiled through. The error says:
1>VCcallCVIDlg.obj : error LNK2019: uninterpretable external sybol _MyDLLCdeclFunction@4,"public: void __thiscall CVCcallCVIDlg::OnBnClickedButton2(void)" (?OnBnClickedButton2@CVCcallCVIDlg@@QAEXXZ) referenced
1>E:\Mat_App\CVI\CVI85Exmpl\dll\simple\VCcallCVI_all\Debug\VCcallCVI.exe : fatal error LNK1120: 1 uninterpretable external command.
the dll program is as that provided by "NI device" of the previous reply.
The Mydll.h used by cvi dll project and the VC2005 caller is :
#include <cvidef.h>
//#include ".\CVIsystemDll\cvidef.h"
/* Here are the function prototypes suitable for including in a
program which uses the dll. */
#ifdef __cplusplus
extern "C" {
#endif
long int WINAPI MyDLLStdcallFunction(char * dummycharname);
long int WINAPI MyDLLCdeclFunction(char * dummycharname);
void WINAPI RunDllUI (void);
#ifdef __cplusplus
}
#endif
The VC2005 caller for RunDll and MyDLLStdcallFunction is:
void CVCcallCVIDlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
/* Tell the dll to run it's user interface */
RunDllUI();
}
void CVCcallCVIDlg::OnBnClickedButton2()
{
// TODO: 在此添加控件通知处理程序代码
tmpint = MyDLLStdcallFunction("Text buffer 1 being passed from CVI to DLL");
//tmpint = MyDLLCdeclFunction("Text buffer 2 being passed from CVI to DLL");
input1 = tmpint;
UpdateData(FALSE);
}