LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using CVI libraries in Visual Studio C DLL

Hello,

 

I am attempting to enhance a legacy VS 2008 Visual C based DLL to use NI Shared Variable/Network Variable support.  From what I have found in the documentation, it seems to imply that CVI libraries can be imported into an existing VS by using the libraries in the ext/msvc64 directory.  I originally included just the cvinetv.lib file to my linker list.  After reading more of the CVI programmer manual, it seemed to imply that cvirt.lib and cvisupp.lib were also needed.  Under both circumstances, the linker throws a conflict between CVI libary and MSCVRT.  Since this is a legacy project and not a CVI wizard generated situation, I'm wondering if there are more tweaks that need to be done my project settings.  I also found a mention of needing to list "libc" under "Ignore Specific Library".  Doing this made no difference either?

 

Any help would be greatly appreciated..especially if this approach is not a valid way to take advantage of shared network variables in a standalone DLL.

 

Thanks,

 

Chris.

 

 

Linker errors:

1>LIBCMT.lib(tidtable.obj) : error LNK2005: _encode_pointer already defined in MSVCRT.lib(MSVCR90.dll)

1>LIBCMT.lib(tidtable.obj) : error LNK2005: _encoded_null already defined in MSVCRT.lib(MSVCR90.dll)

1>LIBCMT.lib(tidtable.obj) : error LNK2005: _decode_pointer already defined in MSVCRT.lib(MSVCR90.dll)

1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _amsg_exit already defined in MSVCRT.lib(MSVCR90.dll)

1>LIBCMT.lib(crt0dat.obj) : error LNK2005: _initterm_e already defined in MSVCRT.lib(MSVCR90.dll)

1>LIBCMT.lib(crtheap.obj) : error LNK2005: _malloc_crt already defined in MSVCRT.lib(MSVCR90.dll)

1>LIBCMT.lib(mlock.obj) : error LNK2005: _unlock already defined in MSVCRT.lib(MSVCR90.dll)

1>LIBCMT.lib(mlock.obj) : error LNK2005: _lock already defined in MSVCRT.lib(MSVCR90.dll)

1>LIBCMT.lib(winxfltr.obj) : error LNK2005: __CppXcptFilter already defined in MSVCRT.lib(MSVCR90.dll)

1>LIBCMT.lib(crt0init.obj) : error LNK2005: __xi_a already defined in MSVCRT.lib(cinitexe.obj)

1>LIBCMT.lib(crt0init.obj) : error LNK2005: __xi_z already defined in MSVCRT.lib(cinitexe.obj)

1>LIBCMT.lib(crt0init.obj) : error LNK2005: __xc_a already defined in MSVCRT.lib(cinitexe.obj)

1>LIBCMT.lib(crt0init.obj) : error LNK2005: __xc_z already defined in MSVCRT.lib(cinitexe.obj)

1> Creating library .\Debug/pil_dlld.lib and object .\Debug/pil_dlld.exp

1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library

1>LIBCMT.lib(crt0.obj) : error LNK2019: unresolved external symbol main referenced in function __tmainCRTStartup

0 Kudos
Message 1 of 6
(4,044 Views)

What operating system are you using?

Take a look at this forum post: http://forums.ni.com/t5/Measurement-Studio-for-VC/Problems-running-in-CVI-a-DLL-made-in-Visual-c-200...

and this http://digital.ni.com/public.nsf/allkb/302C53649D34035886257114007C1C56

National Instruments
Applications Engineer
0 Kudos
Message 2 of 6
(4,028 Views)

Windows 7 64-bit

CVI 2012

Visual Studio Express 2008

0 Kudos
Message 3 of 6
(4,026 Views)

Following 3TTHO2ZW explicitly did not clear up the linker issues.  However, setting it to ignore "libcmt.lib" instead of "libc.lib" did clean up the linker error.  Question is whether this is the valid fix?

Message 4 of 6
(4,021 Views)

Yes the fix is valid, and has been verified with our senior applications engineers.

National Instruments
Applications Engineer
Message 5 of 6
(3,999 Views)

I wonder if it is possible to some forum admin to mark Christopher's last reply as the solution. I've tested what he suggested, since I was trying to do basically the same thing, and it worked like a charm. Also thanks to Edna-S for confirming the validity of the fix.

 

Wouldn't it be useful to update document 3TTHO2ZW to include Christopher's findings?

 

Best regards,



Robst - CLD

Using LabVIEW since version 7.0


Message 6 of 6
(3,807 Views)