LabWindows/CVI

CDotNetCreateInstance

int CDotNetCreateInstance (CDotNetAssemblyHandle assembly, const char *name, void *instance, size_t numberOfParameters, unsigned int parameterTypes[], void * parameters[], CDotNetHandle *exception);

Purpose

Creates a .NET object specified by the name and assembly parameters. This function uses the .NET constructor for this object that matches the number and type of arguments you pass.

Parameters

Input
Name Type Description
assembly CDotNetAssemblyHandle The handle of the .NET assembly that defines the object to create.
Note  If you pass an invalid handle, the .NET execution engine can get corrupted. This can result in an execution engine exception that the library cannot handle, which will cause the system to terminate your program.
name const char * The full type name of the .NET object to create.
numberOfParameters size_t The number of parameters to pass to .NET.
parameterTypes unsigned int [] An array containing the types of the parameters to pass to .NET.
parameters void * [] An array containing the parameters to pass to .NET.

Note  All the parameters must be passed by reference.
Output
Name Type Description
instance void * The handle to the object this function creates. You must call CDotNetDiscardHandle to discard this handle when it is no longer needed.
exception CDotNetHandle The handle to an exception thrown by .NET.

If .NET throws an exception, you can pass this handle to CDotNetGetExceptionInfo to get information from the exception object.

You can pass NULL for this parameter.

Return Value

Name Type Description
status int A value indicating whether an error occurred. Negative error codes indicate function failure.

Error codes are defined in cvi\include\cvidotnet.h.

You can use CDotNetGetErrorDescription to get the description of an error code.

Additional Information

Library: .NET Library

Include file: cvidotnet.h

LabWindows/CVI compatibility: LabWindows/CVI 8.0 and later