LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Example for CVI created dll for VC calling

I use your cvi dll. I use the previouly attached VC2005 code to call it. There are still errors.
 
VCcallCVIDlg.obj : error LNK2019: unknown external symbols "__declspec(dllimport) void __cdecl RunDllUI(void)" (__imp_?RunDllUI@@YAXXZ),this symbol is in "public: void __thiscall CVCcallCVIDlg::OnBnClickedButton1(void)" (?OnBnClickedButton1@CVCcallCVIDlg@@QAEXXZ)  referenced.
1>G:\Mat_App\CVI\CVI85Exmpl\dll\simple\VCcallCVI\Debug\VCcallCVI.exe : fatal error LNK1120: 1 unknown external command.
 
I may need your VC2005 caller.
 
0 Kudos
Message 11 of 12
(1,234 Views)

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);

}

0 Kudos
Message 12 of 12
(1,185 Views)