05-11-2011 07:06 AM
Hi,
I have problems when I try to use in a CVI project a function of a dll created on Microsoft Visual C++ 2010 Express.
I've already read some posts related to the same subject on this forum, for example http://forums.ni.com/t5/LabWindows-CVI/Use-VC-dll-in-CVI/m-p/781190 and http://forums.ni.com/t5/LabWindows-CVI/How-to-use-a-Visual-C-DLL-in-CVI/m-p/10495 but unfortunately even if I've followed the
advices given in those posts, I still can't make the function to work...
The function is supposed to configure and run a TDC8HP (a Time to Digital Converter from Roentdek) in trigger mode. The device works perfectly
when I compile the code on VC++, but we need to make it work on CVI for the tests we pretend to do...
So we thought in creating a DLL on VC++ and import it from CVI to call the function we are interested in. However, it's not working. Our CVI
project already has the .lib generated with the dll and the header file where the functions have been defined. We haven't forgot to use the extern "C"
clause before the function. CVI seems to recognize the function from the .lib but unlike VC+, CVI just doesn't do anything when we run the project!
I attach the files from the dll made with VC++ and those from the CVI project. I would like to know if I'm doing something wrong when I import the dll
or what could be the problem. (Note: as the TDC device must be connected and its drivers installed on the PC when the program is launched, I'm not hoping you to be able to run the program, but maybe I'm doing something wrong when I export the function from VC++ to CVI in the dll). In any case I'll appreciate some help.
Thanks.
05-12-2011 04:51 AM
Hello,
and thank your for posting here.
Please find tutorials which could be useful to resolve your problem:
-> Building a DLL with Visual C++
-> Calling a DLL in CVI: Explicit Linking vs. Implicit Linking (Dynamic vs. Static)
-> How to Integrate 32-Bit Microsoft Visual C/C++ DLLs into LabWindows/CVI
-> Getting Started with the LabWindows/CVI Remote Debugger
Regards,
Jérémy C.
NI France