LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Use VC++ dll in CVI

Solved!
Go to solution

Hi, everyone

When i use a dll file in CVI, i have a problem.

Whe i try to run my project, it shows some error message from the uart.h (my dll). As blow picture:

Can anyone tell me how to slove this error ?

Thanks!

This is my project files: http://d.99081.com/a710756/My project.rar

 

 

0 Kudos
Message 1 of 4
(4,289 Views)

Hello a710756,

 

    To use VC++ DLL in CVI, you must make sure that the exported functions in DLL are in C format, not in C++ format.

    CVI is not a C++ complier. You may reference to the following discussing link:

    http://forums.ni.com/ni/board/message?board.id=180&message.id=721&requireLogin=False

 

    Also, to control COM port, you may reference to example code provided by the NI Example Finder:

0 Kudos
Message 2 of 4
(4,260 Views)
Solution
Accepted by topic author a710756

your DLL is fine, the problem lies in uart.h where some identifier are not defined, namely: WORD and CALLBACK.

those are standard windows definition. #include <windows.h> before including "uart.h", and everything will be ok.

(or best: add the include into uart.h).

0 Kudos
Message 3 of 4
(4,232 Views)

Thanks for AlexandreChen and dummy_decoy,

 

your suggests are very helpful for me.

 

Thank you!

0 Kudos
Message 4 of 4
(4,194 Views)