Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Clash between NI.Common.DLL and niDMM_32.DLL in VS2005

I'm trying to create C# application using Measurement Studio and Visual Studio 2005. This application needs to interface with a DMM (PXI-4070), a DAQ (PXI-6221), and three switches (PXI-2575). I've successfully interfaced with the switches using NationalInstruments.DAQmx.DLL and NationalInstruments.Common.DLL, and in a separate programme I've interfaced successfully with the DMM, using a wrapper class as recommended in [1]. However, when I integrate these into the same programme, things become exceptional.
 
When running the combined programme, at the line where I initialise the DMMWrapper I get an External Exception: "Failure loading driver module." error code status=-1074135030.
 
I experimented by merging the two programmes bit by bit, and found that the error did not occur until I added a reference to NationalInstruments.Common.DLL to the VS2005 Project. On removing the reference, it worked fine again, on adding again, failure. This sounds like the problem in [2], for which no resolution is shown.
 
Please can you help me with this,
Sam Overend
 
References:
 
Software Version information:
Measurement Studio 8.0.1.334
NI-DMM - 2.5.1
NationalInstruments.Common.DLL - 8.0.20.274
NationalInstruments.DAQmx.DLL - 8.3.20.13
NI-SWITCH 3.31
Generally "August 2006" drivers installed.
 
0 Kudos
Message 1 of 4
(4,099 Views)

I've made some progress on my own with this problem. I've a workaround, but, in this workaround, something strange is happening.

Workaround: Run without the debugger active. i.e within the IDE use Debug->Start without Debugging, or double click the .exe in the \bin\debug directory. This runs fine, except for the strange problem described below.

The strange problem:

Consider the following code fragment.

1        private void initialise(){
2                dMM = new NI_DIMM.DMMWrapper2(DMMName, true, true);
3                swSource = DaqSystem.Local.LoadDevice(SourceSwitchName); 
4       }

This results in an the external exception from the original post being thrown on the 2nd line, when run either with or without debugging.

Compare that with the following fragment

        private void initialise()
        {
            Log.LogFile.LogLine("Starting DMM Initialisation");
            try
            {
                dMM = new NI_DIMM.DMMWrapper2(DMMName, true, true);
                string str = DMM.GetString(NI_DIMM.DMMWrapper2Properties.NidmmAttrSpecificDriverRevision);
                Log.LogFile.LogLine("DMM initialised" + str);
                initialiseSwitch();

            }
            catch...
        }

        private void initialiseSwitch()
        {
            try
            {
                swSource = DaqSystem.Local.LoadDevice(SourceSwitchName);
                Log.LogFile.LogLine("Switch initialised");
            }
            catch...
  
        }

This runs fine, as long as I have the Log calls and the try...catch blocks, there seems to be a time delay necessary between initialising the DMM and accessing the switch.

If this is the case, a NIDMMWaitUntilInitialised() function as part of NIDMM_32.DLL would be nice.

0 Kudos
Message 2 of 4
(4,085 Views)
Another workaround would be to go in the project properties, under the Debug tab. Uncheck the box that says "Enable VS hosting process". You should be able to run the app with debugging.

Let me know if this works for you.
Bilal Durrani
NI
0 Kudos
Message 3 of 4
(4,079 Views)

Bilal,

 debugging now works fine.

Cheers,

Sam Overend

 

0 Kudos
Message 4 of 4
(4,059 Views)