05-07-2009 01:50 PM
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.
05-11-2009 09:11 AM
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.
05-11-2009 09:14 AM
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
05-11-2009 04:54 PM
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.
05-21-2009 10:53 AM
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.
05-22-2009 07:02 AM - edited 05-22-2009 07:04 AM
If this is the first instrument added to the project then:
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.
05-26-2009 09:30 PM
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.