Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a .lsb file in Visual C++

I am having a very hard time creating a .lsb file to be used by the CIN. I keep on getting this error:
unresolved external symbol....._CINRun
I followed the intructions of the manual (using external code in labview), inserted all the additional files into my project. I have no idea why my DLL won't compile. I have searched this discussion board and the closest think I could find is something to do with the makefile, I was hoping you could answer my question directly, Thanks in advance.
0 Kudos
Message 1 of 2
(3,556 Views)
Name Decoration Standards have changed between C and C++. This means that the linker is actually looking for `_CINUnload' and is not able to find it - as under C++ the _ character has been replaced by encoded information on the parameters and return value of the function. This may be fixed by forcing the C++ compiler to create an external reference to your CIN code, following the C decoration protocol. This involves making a change to the file [pathtolabview]\CINTOOLS\extcode.h:

On or around line 914 you should find a series of definitions such as
CIN MgErr CINInit(void);
CIN MgErr CINDispose(void);
CIN MgErr CINAbort(void);
CIN MgErr CINLoad(RsrcFile reserved);
CIN MgErr CINUnload(void);
CIN MgErr CINSave(RsrcFile reserved);

These need to be changed to:

exter
n "C" CIN MgErr CINInit(void);
extern "C" CIN MgErr CINDispose(void);
extern "C" CIN MgErr CINAbort(void);
extern "C" CIN MgErr CINLoad(RsrcFile reserved);
extern "C" CIN MgErr CINUnload(void);
extern "C" CIN MgErr CINSave(RsrcFile reserved);

The only remaining function is the CINRun function. In your main CIN file you will find a function definiton such as:

CIN MgErr CINRun( use specific parameters );

This should be changed to:

extern "C" CIN MgErr CINRun( use specific parameters );

NOTE - this is NOT the actual function definition line, but (usuall) the line above with the semi-colon at the end.

NB: If you get an additional error such as "extcode.h not found" when you change from a .C to a .CPP file, simply change the line "#include "extcode.h"" to
"#include "[pathtolabview]\cintools\extcode.h""

Also for MS VC++ 5.0 (and possibly other versions) you can have the entire LSB making process performed within the Integrated Development Environment (ie not from command line) by addi
ng, in project settings, a "Custom Build" command line of "nmake /f [progname].lvm" - you still need to make the .lvm file though.

Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect

0 Kudos
Message 2 of 2
(3,556 Views)