| 1 | // Licensed to the .NET Foundation under one or more agreements. |
| 2 | // The .NET Foundation licenses this file to you under the MIT license. |
| 3 | |
| 4 | #ifndef __CORECLR_DELEGATES_H__ |
| 5 | #define __CORECLR_DELEGATES_H__ |
| 6 | |
| 7 | #include <stdint.h> |
| 8 | |
| 9 | #if defined(_WIN32) |
| 10 | #define CORECLR_DELEGATE_CALLTYPE __stdcall |
| 11 | #ifdef _WCHAR_T_DEFINED |
| 12 | typedef wchar_t char_t; |
| 13 | #else |
| 14 | typedef unsigned short char_t; |
| 15 | #endif |
| 16 | #else |
| 17 | #define CORECLR_DELEGATE_CALLTYPE |
| 18 | typedef char char_t; |
| 19 | #endif |
| 20 | |
| 21 | #define UNMANAGEDCALLERSONLY_METHOD ((const char_t*)-1) |
| 22 | |
| 23 | // Signature of delegate returned by coreclr_delegate_type::load_assembly_and_get_function_pointer |
| 24 | typedef int (CORECLR_DELEGATE_CALLTYPE *load_assembly_and_get_function_pointer_fn)( |
| 25 | const char_t *assembly_path /* Fully qualified path to assembly */, |
| 26 | const char_t *type_name /* Assembly qualified type name */, |
| 27 | const char_t *method_name /* Public static method name compatible with delegateType */, |
| 28 | const char_t *delegate_type_name /* Assembly qualified delegate type name or null |
| 29 | or UNMANAGEDCALLERSONLY_METHOD if the method is marked with |
| 30 | the UnmanagedCallersOnlyAttribute. */, |
| 31 | void *reserved /* Extensibility parameter (currently unused and must be 0) */, |
| 32 | /*out*/ void **delegate /* Pointer where to store the function pointer result */); |
| 33 | |
| 34 | // Signature of delegate returned by load_assembly_and_get_function_pointer_fn when delegate_type_name == null (default) |
| 35 | typedef int (CORECLR_DELEGATE_CALLTYPE *component_entry_point_fn)(void *arg, int32_t arg_size_in_bytes); |
| 36 | |
| 37 | typedef int (CORECLR_DELEGATE_CALLTYPE *get_function_pointer_fn)( |
| 38 | const char_t *type_name /* Assembly qualified type name */, |
| 39 | const char_t *method_name /* Public static method name compatible with delegateType */, |
| 40 | const char_t *delegate_type_name /* Assembly qualified delegate type name or null, |
| 41 | or UNMANAGEDCALLERSONLY_METHOD if the method is marked with |
| 42 | the UnmanagedCallersOnlyAttribute. */, |
| 43 | void *load_context /* Extensibility parameter (currently unused and must be 0) */, |
| 44 | void *reserved /* Extensibility parameter (currently unused and must be 0) */, |
| 45 | /*out*/ void **delegate /* Pointer where to store the function pointer result */); |
| 46 | |
| 47 | #endif // __CORECLR_DELEGATES_H__ |