|
| 1 | +#ifndef KONAN_EXAMPLE_LIB_H |
| 2 | +#define KONAN_EXAMPLE_LIB_H |
| 3 | +#ifdef __cplusplus |
| 4 | +extern "C" { |
| 5 | +#endif |
| 6 | +#ifdef __cplusplus |
| 7 | + typedef bool example_lib_KBoolean; |
| 8 | +#else |
| 9 | + typedef _Bool example_lib_KBoolean; |
| 10 | +#endif |
| 11 | + typedef unsigned short example_lib_KChar; |
| 12 | + typedef signed char example_lib_KByte; |
| 13 | + typedef short example_lib_KShort; |
| 14 | + typedef int example_lib_KInt; |
| 15 | + typedef long long example_lib_KLong; |
| 16 | + typedef unsigned char example_lib_KUByte; |
| 17 | + typedef unsigned short example_lib_KUShort; |
| 18 | + typedef unsigned int example_lib_KUInt; |
| 19 | + typedef unsigned long long example_lib_KULong; |
| 20 | + typedef float example_lib_KFloat; |
| 21 | + typedef double example_lib_KDouble; |
| 22 | + typedef void* example_lib_KNativePtr; |
| 23 | + struct example_lib_KType; |
| 24 | + typedef struct example_lib_KType example_lib_KType; |
| 25 | + |
| 26 | + typedef struct { |
| 27 | + example_lib_KNativePtr pinned; |
| 28 | + } example_lib_kref_com_plangrid_example_APIHost; |
| 29 | + typedef struct { |
| 30 | + example_lib_KNativePtr pinned; |
| 31 | + } example_lib_kref_com_plangrid_example_APIHost_CACAHUETE; |
| 32 | + typedef struct { |
| 33 | + example_lib_KNativePtr pinned; |
| 34 | + } example_lib_kref_com_plangrid_example_APIHost_CAPI; |
| 35 | + typedef struct { |
| 36 | + example_lib_KNativePtr pinned; |
| 37 | + } example_lib_kref_com_plangrid_example_Request; |
| 38 | + typedef struct { |
| 39 | + example_lib_KNativePtr pinned; |
| 40 | + } example_lib_kref_kotlin_collections_Map; |
| 41 | + typedef struct { |
| 42 | + example_lib_KNativePtr pinned; |
| 43 | + } example_lib_kref_com_plangrid_example_Request_Method; |
| 44 | + typedef struct { |
| 45 | + example_lib_KNativePtr pinned; |
| 46 | + } example_lib_kref_kotlin_Any; |
| 47 | + typedef struct { |
| 48 | + example_lib_KNativePtr pinned; |
| 49 | + } example_lib_kref_com_plangrid_example_Request_Method_GET; |
| 50 | + typedef struct { |
| 51 | + example_lib_KNativePtr pinned; |
| 52 | + } example_lib_kref_com_plangrid_example_Request_Method_POST; |
| 53 | + typedef struct { |
| 54 | + example_lib_KNativePtr pinned; |
| 55 | + } example_lib_kref_com_plangrid_example_Request_Method_PUT; |
| 56 | + typedef struct { |
| 57 | + example_lib_KNativePtr pinned; |
| 58 | + } example_lib_kref_com_plangrid_example_Request_Method_DELETE; |
| 59 | + typedef struct { |
| 60 | + example_lib_KNativePtr pinned; |
| 61 | + } example_lib_kref_com_plangrid_example_Request_Method_PATCH; |
| 62 | + typedef struct { |
| 63 | + example_lib_KNativePtr pinned; |
| 64 | + } example_lib_kref_com_plangrid_example_Request_Response; |
| 65 | + typedef struct { |
| 66 | + example_lib_KNativePtr pinned; |
| 67 | + } example_lib_kref_com_plangrid_example_Request_Response_DataResponse; |
| 68 | + typedef struct { |
| 69 | + example_lib_KNativePtr pinned; |
| 70 | + } example_lib_kref_com_plangrid_example_Request_Response_FileResponse; |
| 71 | + typedef struct { |
| 72 | + example_lib_KNativePtr pinned; |
| 73 | + } example_lib_kref_com_plangrid_example_Request_Response_ErrorResponse; |
| 74 | + typedef struct { |
| 75 | + example_lib_KNativePtr pinned; |
| 76 | + } example_lib_kref_kotlin_Error; |
| 77 | + |
| 78 | + |
| 79 | + typedef struct { |
| 80 | + /* Service functions. */ |
| 81 | + void(*DisposeStablePointer)(example_lib_KNativePtr ptr); |
| 82 | + void(*DisposeString)(const char* string); |
| 83 | + example_lib_KBoolean(*IsInstance)(example_lib_KNativePtr ref, const example_lib_KType* type); |
| 84 | + |
| 85 | + /* User functions. */ |
| 86 | + struct { |
| 87 | + struct { |
| 88 | + struct { |
| 89 | + struct { |
| 90 | + struct { |
| 91 | + struct { |
| 92 | + example_lib_KType* (*_type)(void); |
| 93 | + struct { |
| 94 | + example_lib_kref_com_plangrid_example_APIHost(*get)(); /* enum entry for CACAHUETE. */ |
| 95 | + } CACAHUETE; |
| 96 | + struct { |
| 97 | + example_lib_kref_com_plangrid_example_APIHost(*get)(); /* enum entry for CAPI. */ |
| 98 | + } CAPI; |
| 99 | + } APIHost; |
| 100 | + struct { |
| 101 | + example_lib_KType* (*_type)(void); |
| 102 | + example_lib_kref_com_plangrid_example_Request(*Request)(const char* path, example_lib_kref_kotlin_collections_Map queryParams, const char* body, example_lib_kref_com_plangrid_example_Request_Method method); |
| 103 | + const char* (*get_path)(example_lib_kref_com_plangrid_example_Request thiz); |
| 104 | + example_lib_kref_kotlin_collections_Map(*get_queryParams)(example_lib_kref_com_plangrid_example_Request thiz); |
| 105 | + const char* (*get_body)(example_lib_kref_com_plangrid_example_Request thiz); |
| 106 | + example_lib_kref_com_plangrid_example_Request_Method(*get_method)(example_lib_kref_com_plangrid_example_Request thiz); |
| 107 | + example_lib_KBoolean(*equals)(example_lib_kref_com_plangrid_example_Request thiz, example_lib_kref_kotlin_Any other); |
| 108 | + example_lib_KInt(*hashCode)(example_lib_kref_com_plangrid_example_Request thiz); |
| 109 | + const char* (*toString)(example_lib_kref_com_plangrid_example_Request thiz); |
| 110 | + const char* (*component1)(example_lib_kref_com_plangrid_example_Request thiz); |
| 111 | + example_lib_kref_kotlin_collections_Map(*component2)(example_lib_kref_com_plangrid_example_Request thiz); |
| 112 | + const char* (*component3)(example_lib_kref_com_plangrid_example_Request thiz); |
| 113 | + example_lib_kref_com_plangrid_example_Request_Method(*component4)(example_lib_kref_com_plangrid_example_Request thiz); |
| 114 | + example_lib_kref_com_plangrid_example_Request(*copy)(example_lib_kref_com_plangrid_example_Request thiz, const char* path, example_lib_kref_kotlin_collections_Map queryParams, const char* body, example_lib_kref_com_plangrid_example_Request_Method method); |
| 115 | + struct { |
| 116 | + example_lib_KType* (*_type)(void); |
| 117 | + struct { |
| 118 | + example_lib_kref_com_plangrid_example_Request_Method(*get)(); /* enum entry for GET. */ |
| 119 | + } GET; |
| 120 | + struct { |
| 121 | + example_lib_kref_com_plangrid_example_Request_Method(*get)(); /* enum entry for POST. */ |
| 122 | + } POST; |
| 123 | + struct { |
| 124 | + example_lib_kref_com_plangrid_example_Request_Method(*get)(); /* enum entry for PUT. */ |
| 125 | + } PUT; |
| 126 | + struct { |
| 127 | + example_lib_kref_com_plangrid_example_Request_Method(*get)(); /* enum entry for DELETE. */ |
| 128 | + } DELETE; |
| 129 | + struct { |
| 130 | + example_lib_kref_com_plangrid_example_Request_Method(*get)(); /* enum entry for PATCH. */ |
| 131 | + } PATCH; |
| 132 | + } Method; |
| 133 | + struct { |
| 134 | + example_lib_KType* (*_type)(void); |
| 135 | + struct { |
| 136 | + example_lib_KType* (*_type)(void); |
| 137 | + example_lib_kref_com_plangrid_example_Request_Response_DataResponse(*DataResponse)(const char* data); |
| 138 | + const char* (*get_data)(example_lib_kref_com_plangrid_example_Request_Response_DataResponse thiz); |
| 139 | + } DataResponse; |
| 140 | + struct { |
| 141 | + example_lib_KType* (*_type)(void); |
| 142 | + example_lib_kref_com_plangrid_example_Request_Response_FileResponse(*FileResponse)(const char* filePath); |
| 143 | + const char* (*get_filePath)(example_lib_kref_com_plangrid_example_Request_Response_FileResponse thiz); |
| 144 | + } FileResponse; |
| 145 | + struct { |
| 146 | + example_lib_KType* (*_type)(void); |
| 147 | + example_lib_kref_com_plangrid_example_Request_Response_ErrorResponse(*ErrorResponse)(example_lib_kref_kotlin_Error error); |
| 148 | + example_lib_kref_kotlin_Error(*get_error)(example_lib_kref_com_plangrid_example_Request_Response_ErrorResponse thiz); |
| 149 | + } ErrorResponse; |
| 150 | + } Response; |
| 151 | + } Request; |
| 152 | + } example; |
| 153 | + } plangrid; |
| 154 | + } com; |
| 155 | + } root; |
| 156 | + } kotlin; |
| 157 | + } example_lib_ExportedSymbols; |
| 158 | + extern example_lib_ExportedSymbols* example_lib_symbols(void); |
| 159 | +#ifdef __cplusplus |
| 160 | +} /* extern "C" */ |
| 161 | +#endif |
| 162 | +#endif /* KONAN_EXAMPLE_LIB_H */ |
| 163 | + |
| 164 | +// Code like below would hardly appear in practice |
| 165 | +// but it's worth noting we don't support it |
| 166 | +#if 0 |
| 167 | +struct DLL_API TestAnonTypesWithAnonFields |
| 168 | +{ |
| 169 | +public: |
| 170 | + struct |
| 171 | + { |
| 172 | + struct |
| 173 | + { |
| 174 | + }; |
| 175 | + }; |
| 176 | + struct |
| 177 | + { |
| 178 | + struct |
| 179 | + { |
| 180 | + }; |
| 181 | + }; |
| 182 | + struct |
| 183 | + { |
| 184 | + struct |
| 185 | + { |
| 186 | + }; |
| 187 | + }; |
| 188 | + struct |
| 189 | + { |
| 190 | + struct |
| 191 | + { |
| 192 | + }; |
| 193 | + }; |
| 194 | +}; |
| 195 | +#endif |
0 commit comments