LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Linking your application with other NI dll's

Hi,

 

I am creating a DLL that needs to make calls to DMM(PXI-4070), Scope (PXI-5102) and Function Generator (PXI-5402). They all have available DLL's and I need to include  .LIB files in my project. Here's the problem. Their DLL's are all in a format: name_32.dll, but .LIB files are not (i.e. niscope.lib). It links fine but when I run the system it is very unstable (frequent crashes). Also when I inspect my DLL using Dependency Walker, it does not seem to be linked with name_32.dll. The appropriate dll is not listed on a list of dependent dll's. (except for nidmm_32.dll). I am suspecting that this maybe the cause of my problems (operating system loading 2 copies of the same dll? - my guess). Also, what I do not understand it the DLL and LIB files have different dates. One way for me to make sure I am using proper DLL/LIB combination is to compare dates, when they are different I can never be sure if they are related. I cannot explain this discrepancy.

I also tried using CVI to build an import library using one of its options and renaming it to name_32.Lib. That seemed to have helped a little but did not solve the problem.

Any suggestions will be appreciated,

Jerry.

0 Kudos
Message 1 of 7
(4,075 Views)

Hi Jerry,

 

When you are creating your DLL that makes all of these driver calls, have you tried loading the .fp file into your project rather than using the .lib and .dll files directly?  This is the recommended way of accessing our drivers and it may be the root of the problem you are seeing in your instability.

Eric B.
National Instruments
0 Kudos
Message 2 of 7
(4,035 Views)

Hi Eric,

 

Thank you for your response. I am not familiar with loading .fp. Could you describe that process or point me to a document that does that?

Jerry

0 Kudos
Message 3 of 7
(4,032 Views)

Jerry,

 

Loading the instrument file (.fp file) is just a way to provide you with a list of the functions available in the driver and allows you to easily insert those functions and declare variables.  If you started a project and used the instrument file to write your code by inserting the function calls, it adds the necessary header files to your project automatically.  I tried to replicate your issue by creating a dll with some NI-FGEN calls in them, then I called that dll in another program and it seemed to work fine.  I didn't have to do any linking to any dlls or libraries.  I also used Dependency Walker on the resulting dll and there were no direct links to any of those dlls. I don't know that using the .fp files does any other sort of linking, so I'm not sure if doing that would help you any, but it might be worth a shot.  To load it, just go to Instrument»Load in CVI, then navigate to the .fp file (NI-FGEN is under C:\Program Files\IVI\Drivers\niFgen on my computer, and the other two will be in similar locations) and load the file.  The instruments will appear under the Instruments folder in the lower left pane, and you can select the functions from that list.

Eric B.
National Instruments
0 Kudos
Message 4 of 7
(4,013 Views)

Thank you for your response.

Is there a way to make this reference to .fp files permanent in the project? It seems when I close CVI and reopen my project I need to do it all over again.

 

Jerry.

0 Kudos
Message 5 of 7
(3,948 Views)

If this is the first instrument added to the project then:

  • in the project pane on the left side right click on the project name
  • select Add existing file
  • in the file select dialog, change the "files of type" entry to .fp from the drop down.
  • navigate to the .fp for the instrument and add it as you would any other file.

Once one instrument is loaded you can add more by right clicking on the instrument files entry in the project tree. 

With the instruments added to the project cvi will load them when the project is opened.

Message Edited by mvr on 05-22-2009 07:04 AM
0 Kudos
Message 6 of 7
(3,929 Views)

Hi Jerry,

 

In short, if you simply load the fp (instrument driver) to the instruments list, this is retained from session to session. Meaning when you close CVI, that fp is no longer loaded. To make it permanantly open up every time you open a project, you can add it directly to the project.

 

In addition to the method mvr suggested, You can also:

 

If you want it to persist from session to session regardless of which project you have open, you can have CVI load it as a Library instead by adding it to the Library List.

 

Jervin Justin
NI TestStand Product Manager
0 Kudos
Message 7 of 7
(3,890 Views)