LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

use generic list in .net library

Solved!
Go to solution

Hello,

 

I use a device driver written in .net. Also I imported the device driver. Now I need a generic list with a special data type to call a methode from device driver. The data type is telos.SpiMaster.MessageProcessor.Message. This data type is known in the device driver, but not known in the mscorlib.

 

I want to create a generic List with help of mscorlib by calling:

 

LV_iErrorCode = System_Collections_Generic_List_T1__Create_2(LV_ptdsMessages, "telos.SpiMaster.MessageProcessor.Message", &LV_ptdsError);

 This methode returns in LV_iErrorCode -6578 and LV_ptdsError tells me:

Message: Fehler in der Anwendung
Source: NationalInstruments.CVI.Reflector
Trace: bei NationalInstrumets.CVI.Reflector.GetTypeFromName2(String name, Assembly assembly)
bei NationalInstrumets.CVI.Reflector.MakeGenericType(String name, Int32 numGenericTypes, SByte** genericTypes) ... and so on

 All this tells me, that the function doesn't know this data type.

 

How can I inform the NationalInstruments.CVI.Reflector about this data type?

 

Can you help me?

 

Greetings

Christian

0 Kudos
Message 1 of 3
(4,845 Views)
Solution
Accepted by topic author c.steffen

First try calling the Initialize_* function in the CVI generated .NET wrapper for your .NET assembly before trying to create the generic list with your type. If this does not work, you may have to pass the Fully Qualified Assembly Name of the type instead of just the Namespace.TypeName. 

 

The CVI help for the type name (T) parameter of the System_Collections_Generic_List_T1__Create_2 function describes how to pass the type name and shows some examples. I have copied this below:

 

Pass the name of the type used to specialize this generic parameter. If the type you pass is defined in mscorlib or in the target assembly, then you can just pass the full name of the type. If not, you must pass the assembly-qualified name of the type, that is, the full name of the type followed by the assembly information, separated by a comma.

Examples:
Fundamental types:
C string (char *) - "System.String"
int - "System.Int32"
short - "System.Int16"
char - "System.SByte"
__int64 - "System.Int64"
unsigned int - "System.UInt32"
unsigned short - "System.UInt16"
unsigned char - "System.Byte"
unsigned __int64 - "System.UInt64"
float - "System.Single"
double - "System.Double"
C boolean (int) - "System.Boolean"
Type in mscorlib: "System.Collections.ArrayList"
Type in target assembly: "Namespace.TypeName"
Type in other assembly: "OtherNamespace.OtherTypeName, OtherAssembly"
Type in other strong-named assembly: "OtherSNNamespace.OtherSNTypeName, OtherSNAssembly, Version=<version info>, Culture=<culture info>, PublicKeyToken=<token info>"

 

Hope this helps.

 

0 Kudos
Message 2 of 3
(4,811 Views)

@Mohan wrote:

...

Type in other strong-named assembly: "OtherSNNamespace.OtherSNTypeName, OtherSNAssembly, Version=<version info>, Culture=<culture info>, PublicKeyToken=<token info>"

 


Thanks. This is the right hint to me.

 

Greetings

Christian

0 Kudos
Message 3 of 3
(4,790 Views)