CDotNetCreateDelegate
- Updated2023-02-21
- 2 minute(s) read
int CDotNetCreateDelegate (CDotNetAssemblyHandle assembly, const char *delegateName, size_t numberOfGenericTypes, const char * genericTypes[], CDotNetCallback callbackFunction, void *callbackData, void *reserved, void *delegate, CDotNetHandle *exception);
Purpose
Creates a .NET delegate object specified by delegateName and assembly.
When you invoke the delegate, the library calls your callback function with your callback data.
Parameters
| Input | ||||
| Name | Type | Description | ||
| assembly | CDotNetAssemblyHandle | The handle of the .NET assembly that defines the object to create.
|
||
| delegateName | const char * | The name of the .NET delegate to create. | ||
| numberOfGenericTypes | size_t | The number of generic type parameters to pass to .NET. | ||
| genericTypes | const char * [] | The generic type names to pass to .NET. | ||
| callbackFunction | CDotNetCallback | The callback function that the library calls when the system invokes the .NET delegate. The callback function is of type CDotNetCallback and takes the following form: int CVICALLBACK CallbackFunction(CDotNetHandle delegate, void *parameters[], size_t numParameters, void *returnValue, void *callbackData, void *reserved); When the library calls the callback function, delegate contains the handle of the invoked delegate object. parameters contains references to the parameters of the .NET delegate, and returnValue is a reference to the return value of the .NET delegate, if any. callbackData and reserved contain the corresponding values you passed to CDotNetCreateDelegate. The callback function should return 0; otherwise, the library throws an exception that is returned to the program sending the event. |
||
| callbackData | void * | The data that the library passes to the callback function when you call the callback function. | ||
| reserved | void * | Reserved for use by the .NET library. Pass 0. |
||
| Output | ||||
| Name | Type | Description | ||
| delegate | void * | The delegate handle that corresponds to the delegate object. You must call CDotNetDiscardHandle to discard this handle when you finish with it. |
||
| 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.5 and later
