03-14-2007 02:39 PM
using
System;using NationalInstruments;
using
NationalInstruments.InstrumentDriverDotNetWizard;namespace
InstrumentDriverDotNetWizard{
/// <summary> /// Console App wrapper for NI'ls InstrumentDriverDotNetWizard. /// </summary> class ConsoleApp{
/// <summary> /// The main entry point for the application. /// </summary>[
STAThread] static void Main(string[] args){
if (args.Length != 1){
Console.WriteLine("Syntax: InstrumentDriverDotNetWizardConsoleApp fpfile");}
else{
String fppath = args[0]; String codepath = fppath.Replace(".fp",".cs");System.IO.
FileStream fpfile = System.IO.File.OpenRead(fppath);InstrumentDriver driver =
new InstrumentDriver(fpfile );GeneratorOptions options =
new GeneratorOptions(); // //GUI App does this: // //Is it the default? or is it the result of UpdateFromDriver()? // options.Language = Language.CSharp; // options.GenerateComments = true; // options.Namespace = "InstrumentDriverInterop.Ivi"; // options.CallingConvention = CallingConvention.StdCall; // options.ClassName = "KE622X"; // options.Dll = "KE622X_32.dll";options.UpdateFromDriver(driver);
options.GenerateComments =
false;// Console.WriteLine( driver.LooksLikeVxiPnpDriver );
// Console.WriteLine( driver.LooksLikeIviDriver );
System.IO.
StreamWriter codefile = new System.IO.StreamWriter(codepath);codefile.Write( SimpleGenerator.Generate(driver,options));
codefile.Close();
// Console.WriteLine( driver.SubFile.Attributes.Length );
// Console.WriteLine( driver.SubFile.Values.Count );
// Console.WriteLine( driver.HeaderFile.SymbolExists("IVI_ATTR_SPECIFIC_DRIVER_PREFIX") );
}
}
}
}
03-15-2007 10:55 AM
03-15-2007 11:44 AM
I think I need to re-explain: I am developing an instrument driver, not using one. The utility above did *SOMETHING* to the instrument driver as built from within CVI to make it useable from .NET.
The original author of the code was using much older software versions than I am. I think they used CVI5.something. The LabVIEW versions they used for other pieces of the same product were 5 and 6. They used some strange combination of VC6++ and .Net 2003.
In contrast, I am using CVI8.0.1 (have 8.1, just haven't installed it for myself), LabVIEW 7.1, 8.0, 8.2, and I have converted everything C++ to .Net 2005 except this.
This, I get a compile error on this utility:
Error 1 The type or namespace name 'InstrumentDriverDotNetWizard' does not exist in the namespace 'NationalInstruments' (are you missing an assembly reference?) C:\PlatformESP\TSB\Tools\InstrumentDriverDotNetWizard\ConsoleApp.cs 3 27 InstrumentDriverDotNetWizardConsoleApp
I can't find the reference I need to add. The DLL they sent me isn't a valid .COM component.
So ...
1) Any idea if I still need to take this step or is a driver built with modern CVI capable of being called from .Net without using this kludgy conversion tool?
2) If I still need to do something kludgy, where can I find said reference?
03-15-2007 12:54 PM