LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Building a library

Hi,

I need some help.

I've finished to code my program and now, I need to some important things :

I'm under MSVC 2005 and I use ini functions provided with NI Labwindows CVI
What I've done to use those function is to build a .lib and its associated .dll.
Today I run my .exe with the dll in the same directory.

What I need now, is to build a static library, just a .lib for the INI function, but when i use the .lib i've built in CVI, MSvc gives me errors.
I'm joining a screenshot.

(I've tried different methods, build with inifile.c and inifile.h or directly with .obj)


In a second time, I need to export my application on another pc.
With depends.exe i can see dependencies of my .exe. Do I need to copy all .dll files in order to have it to run on my other PC?

I'm not friend with .lib and .dll and it's a bit difficult to understand how all that world works.

Thanks in advance for your help.
0 Kudos
Message 1 of 6
(3,572 Views)
0 Kudos
Message 2 of 6
(3,565 Views)
Hello,

Did you make sure to include the following three files in your Visual Studio project?



Note that if you are not using a 64 bit OS, the path will most likely be just C:\Program Files\ ...

NickB
National Instruments


Message Edited by nickb on 07-01-2008 09:59 AM
0 Kudos
Message 3 of 6
(3,546 Views)
Also, as I was looking through past forums, I came across this entry which clarifies why you are receiving those link errors.  In using inifile.fp, you are taking toolbox.obj into VC, and because toolbox.obj implements macros like __gererrno differently than VC, you receive linker errors.  The linked forum post describes how to take care of this issue.  In addition to that, the last link error is for a function that is defined in the ActiveX library, and should be taken care of by adding cviauto.lib to your VC project. 

NickB
National Instruments


Message Edited by nickb on 07-01-2008 11:26 AM
0 Kudos
Message 4 of 6
(3,525 Views)
Hi,

thank you for your answer.

I already included cvisupp.lib and cvirt.lib in my final VC project.

I tried to build a .lib with the 4 following files in VC
inifile.h, toolbox.h, inifile.c, toolbox.c

Here, it gives me warning which are important : some macros are redefined
I'm joining a screenshot of the warnings.

Then I use the lib in my final VC project and i got a lot of redefinition. Conflict with msvcrt.lib
I'm joining a screenshot too.

Concerning the stub file method, I don't what it is, so I preferred using toolbox.c method

Thanks


Message Edité par NI_Device_user_sb le 07-02-2008 03:10 AM
Download All
0 Kudos
Message 5 of 6
(3,504 Views)
Hello,

I tried recreating your scenario with our CVI example ini project.  When I tried this at first, I was able to build the project without problem.  However, I was able to reproduce the LNK2005 errors you are seeing by opening the properties for my project that was using the .lib that I built, and then changing the "Runtime Library" property that can be found under Configuration Properties>>C/C++>>Code Generation to be different than the option that was used for the first project that I built the .lib with.  I would begin by first checking to make sure that these Runtime Library properties are the same between your two projects.  If they are the same, or perhaps they are different for a specific reason, you could also try opening the project properties up once more and browsing to Configuration Properties>>Linker>>Input.  There you can specify to "Ignore Specific Library" LIBCMT.lib

NickB
National Instruments
0 Kudos
Message 6 of 6
(3,459 Views)