Skip to content

Commit 2b3f8a5

Browse files
committed
Set calling convention to cdecl for all delegates in unitytls_interface_struct
1 parent 96c5d15 commit 2b3f8a5

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

mcs/class/System/Mono.UnityTls/UnityTls.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,72 +178,103 @@ public class unitytls_interface_struct
178178
public readonly UInt64 UNITYTLS_INVALID_HANDLE;
179179
public readonly unitytls_tlsctx_protocolrange UNITYTLS_TLSCTX_PROTOCOLRANGE_DEFAULT;
180180

181+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
181182
public delegate unitytls_errorstate unitytls_errorstate_create_t();
182183
public unitytls_errorstate_create_t unitytls_errorstate_create;
184+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
183185
public delegate void unitytls_errorstate_raise_error_t(unitytls_errorstate* errorState, unitytls_error_code errorCode);
184186
public unitytls_errorstate_raise_error_t unitytls_errorstate_raise_error;
185187

188+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
186189
public delegate unitytls_key_ref unitytls_key_get_ref_t(unitytls_key* key, unitytls_errorstate* errorState);
187190
public unitytls_key_get_ref_t unitytls_key_get_ref;
191+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
188192
public delegate unitytls_key* unitytls_key_parse_der_t(UInt8* buffer, size_t bufferLen, Int8* password, size_t passwordLen, unitytls_errorstate* errorState);
189193
public unitytls_key_parse_der_t unitytls_key_parse_der;
194+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
190195
public delegate unitytls_key* unitytls_key_parse_pem_t(Int8* buffer, size_t bufferLen, Int8* password, size_t passwordLen, unitytls_errorstate* errorState);
191196
public unitytls_key_parse_pem_t unitytls_key_parse_pem;
197+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
192198
public delegate void unitytls_key_free_t(unitytls_key* key);
193199
public unitytls_key_free_t unitytls_key_free;
194200

201+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
195202
public delegate size_t unitytls_x509_export_der_t(unitytls_x509_ref cert, UInt8* buffer, size_t bufferLen, unitytls_errorstate* errorState);
196203
public unitytls_x509_export_der_t unitytls_x509_export_der;
197204

205+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
198206
public delegate unitytls_x509list_ref unitytls_x509list_get_ref_t(unitytls_x509list* list, unitytls_errorstate* errorState);
199207
public unitytls_x509list_get_ref_t unitytls_x509list_get_ref;
208+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
200209
public delegate unitytls_x509_ref unitytls_x509list_get_x509_t(unitytls_x509list_ref list, size_t index, unitytls_errorstate* errorState);
201210
public unitytls_x509list_get_x509_t unitytls_x509list_get_x509;
211+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
202212
public delegate unitytls_x509list* unitytls_x509list_create_t(unitytls_errorstate* errorState);
203213
public unitytls_x509list_create_t unitytls_x509list_create;
214+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
204215
public delegate void unitytls_x509list_append_t(unitytls_x509list* list, unitytls_x509_ref cert, unitytls_errorstate* errorState);
205216
public unitytls_x509list_append_t unitytls_x509list_append;
217+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
206218
public delegate void unitytls_x509list_append_der_t(unitytls_x509list* list, UInt8* buffer, size_t bufferLen, unitytls_errorstate* errorState);
207219
public unitytls_x509list_append_der_t unitytls_x509list_append_der;
220+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
208221
public delegate void unitytls_x509list_append_pem_t(unitytls_x509list* list, Int8* buffer, size_t bufferLen, unitytls_errorstate* errorState);
209222
public unitytls_x509list_append_der_t unitytls_x509list_append_pem;
223+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
210224
public delegate void unitytls_x509list_free_t(unitytls_x509list* list);
211225
public unitytls_x509list_free_t unitytls_x509list_free;
212226

227+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
213228
public delegate unitytls_x509verify_result unitytls_x509verify_default_ca_t(unitytls_x509list_ref chain, Int8* cn, size_t cnLen, unitytls_x509verify_callback cb, void* userData, unitytls_errorstate* errorState);
214229
public unitytls_x509verify_default_ca_t unitytls_x509verify_default_ca;
230+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
215231
public delegate unitytls_x509verify_result unitytls_x509verify_explicit_ca_t(unitytls_x509list_ref chain, unitytls_x509list_ref trustCA, Int8* cn, size_t cnLen, unitytls_x509verify_callback cb, void* userData, unitytls_errorstate* errorState);
216232
public unitytls_x509verify_explicit_ca_t unitytls_x509verify_explicit_ca;
217233

234+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
218235
public delegate unitytls_tlsctx* unitytls_tlsctx_create_server_t(unitytls_tlsctx_protocolrange supportedProtocols, unitytls_tlsctx_callbacks callbacks, unitytls_x509list_ref certChain, unitytls_key_ref leafCertificateKey, unitytls_errorstate* errorState);
219236
public unitytls_tlsctx_create_server_t unitytls_tlsctx_create_server;
237+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
220238
public delegate unitytls_tlsctx* unitytls_tlsctx_create_client_t(unitytls_tlsctx_protocolrange supportedProtocols, unitytls_tlsctx_callbacks callbacks, Int8* cn, size_t cnLen, unitytls_errorstate* errorState);
221239
public unitytls_tlsctx_create_client_t unitytls_tlsctx_create_client;
240+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
222241
public delegate void unitytls_tlsctx_server_require_client_authentication_t(unitytls_tlsctx* ctx, unitytls_x509list_ref clientAuthCAList, unitytls_errorstate* errorState);
223242
public unitytls_tlsctx_server_require_client_authentication_t unitytls_tlsctx_server_require_client_authentication;
243+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
224244
public delegate void unitytls_tlsctx_set_certificate_callback_t(unitytls_tlsctx* ctx, unitytls_tlsctx_certificate_callback cb, void* userData, unitytls_errorstate* errorState);
225245
public unitytls_tlsctx_set_certificate_callback_t unitytls_tlsctx_set_certificate_callback;
246+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
226247
public delegate void unitytls_tlsctx_set_trace_callback_t(unitytls_tlsctx* ctx, unitytls_tlsctx_trace_callback cb, void* userData, unitytls_errorstate* errorState);
227248
public unitytls_tlsctx_set_trace_callback_t unitytls_tlsctx_set_trace_callback;
249+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
228250
public delegate void unitytls_tlsctx_set_x509verify_callback_t(unitytls_tlsctx* ctx, unitytls_tlsctx_x509verify_callback cb, void* userData, unitytls_errorstate* errorState);
229251
public unitytls_tlsctx_set_x509verify_callback_t unitytls_tlsctx_set_x509verify_callback;
252+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
230253
public delegate void unitytls_tlsctx_set_supported_ciphersuites_t(unitytls_tlsctx* ctx, unitytls_ciphersuite* supportedCiphersuites, size_t supportedCiphersuitesLen, unitytls_errorstate* errorState);
231254
public unitytls_tlsctx_set_supported_ciphersuites_t unitytls_tlsctx_set_supported_ciphersuites;
255+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
232256
public delegate unitytls_ciphersuite unitytls_tlsctx_get_ciphersuite_t(unitytls_tlsctx* ctx, unitytls_errorstate* errorState);
233257
public unitytls_tlsctx_get_ciphersuite_t unitytls_tlsctx_get_ciphersuite;
258+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
234259
public delegate unitytls_protocol unitytls_tlsctx_get_protocol_t(unitytls_tlsctx* ctx, unitytls_errorstate* errorState);
235260
public unitytls_tlsctx_get_protocol_t unitytls_tlsctx_get_protocol;
261+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
236262
public delegate unitytls_x509verify_result unitytls_tlsctx_process_handshake_t(unitytls_tlsctx* ctx, unitytls_errorstate* errorState);
237263
public unitytls_tlsctx_process_handshake_t unitytls_tlsctx_process_handshake;
264+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
238265
public delegate size_t unitytls_tlsctx_read_t(unitytls_tlsctx* ctx, UInt8* buffer, size_t bufferLen, unitytls_errorstate* errorState);
239266
public unitytls_tlsctx_read_t unitytls_tlsctx_read;
267+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
240268
public delegate size_t unitytls_tlsctx_write_t(unitytls_tlsctx* ctx, UInt8* data, size_t bufferLen, unitytls_errorstate* errorState);
241269
public unitytls_tlsctx_write_t unitytls_tlsctx_write;
270+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
242271
public delegate void unitytls_tlsctx_notify_close_t(unitytls_tlsctx* ctx, unitytls_errorstate* errorState);
243272
public unitytls_tlsctx_notify_close_t unitytls_tlsctx_notify_close;
273+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
244274
public delegate void unitytls_tlsctx_free_t(unitytls_tlsctx* ctx);
245275
public unitytls_tlsctx_free_t unitytls_tlsctx_free;
246276

277+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
247278
public delegate void unitytls_random_generate_bytes_t(UInt8 * buffer, size_t bufferLen, unitytls_errorstate * errorState);
248279
public unitytls_random_generate_bytes_t unitytls_random_generate_bytes;
249280
}

0 commit comments

Comments
 (0)