LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Method parmeters: CVI DLL to C# assembly?

I'm starting to get away from using CVI to program my test code and plan on using the .NET based Measurement Studio libraries in C#. The problem is that I have lots of legacy code, and I'm still climbing the learning curve associated with C# and .NET.

Let's say I have a CVI function with the signature...

int foo(int number, char *args[]);

How would I import that into C#? I've been able to get some of it to work, but what confounds me is the pointer-to-pointer-to-char.

C# Code:

[DllImport("mydll.dll", EntryPoint="foo")]
private static extern int CVI_foo (int number, ?????);


What should I replace the ????? with?

0 Kudos
Message 1 of 2
(3,170 Views)
Transitioning from CVI to C# is pretty much just a matter of mapping memory configurations of those pointers to C# structures.  So, in this question, you asked about a type char *args[].  The representation for this structure in memory is simply an array of strings.  So the equivalent in C# is string[] args.
 
For more information on the transition from CVI to C#, you can find a wealth of resources available via google and MSDN.  The transition that you are making from one programming language to another is not as much a transition from CVI, but rather from C.  That being said, while there may not be all that many resources available for the transition from CVI to C#, everywhere you look on the web you can find help transitioning from C to C#.
 
Thanks,
Andy McRorie
Applications Engineer
National Instruments
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 2 of 2
(3,133 Views)