comparison dyncallback/dyncall_callback.h @ 533:71c884e610f0

- integration of patches from Raphael Luba, Thekla, Inc.: * integration of aggregate-by-value (struct, union) support patch for x64 (win and sysv) * windows/x64 asm additions to specify how stack unwinds (help for debuggers, exception handling, etc.) * see Changelog for details - new calling convention modes for thiscalls (platform agnostic, was specific before) * new signature character for platform agnostic thiscalls ('*' / DC_SIGCHAR_CC_THISCALL) - dcCallF(), dcVCallF(), dcArgF() and dcVArgF(): * added support for aggregates-by-value (wasn't part of patch) * change that those functions don't implicitly call dcReset() anymore, which was unflexible (breaking change) - added macros to feature test implementation for aggregate-by-value and syscall support - changed libdyncall_s.lib and libdyncallback_s.lib order in callback test makefiles, as some toolchains are picky about order - doc: * man page updates to describe aggregate interface * manual overview changes to highlight platforms with aggregate-by-value support - test/plain: replaced tests w/ old/stale sctruct interface with new aggregate one
author Tassilo Philipp
date Thu, 21 Apr 2022 13:35:47 +0200
parents e221473a8217
children d717a5561335
comparison
equal deleted inserted replaced
532:d4bf63ab9164 533:71c884e610f0
4 Library: dyncallback 4 Library: dyncallback
5 File: dyncallback/dyncall_callback.h 5 File: dyncallback/dyncall_callback.h
6 Description: Callback - Interface 6 Description: Callback - Interface
7 License: 7 License:
8 8
9 Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, 9 Copyright (c) 2007-2022 Daniel Adler <dadler@uni-goettingen.de>,
10 Tassilo Philipp <tphilipp@potion-studios.com> 10 Tassilo Philipp <tphilipp@potion-studios.com>
11 11
12 Permission to use, copy, modify, and distribute this software for any 12 Permission to use, copy, modify, and distribute this software for any
13 purpose with or without fee is hereby granted, provided that the above 13 purpose with or without fee is hereby granted, provided that the above
14 copyright notice and this permission notice appear in all copies. 14 copyright notice and this permission notice appear in all copies.
30 #include "dyncall_signature.h" 30 #include "dyncall_signature.h"
31 #include "dyncall_value.h" 31 #include "dyncall_value.h"
32 32
33 typedef struct DCCallback DCCallback; 33 typedef struct DCCallback DCCallback;
34 34
35 /* return value is the type encoded as a type-specifying signature char (see dyncall_signature.h) */ 35 /* callback handler:
36 typedef char (DCCallbackHandler)(DCCallback* pcb, DCArgs* args, DCValue* result, void* userdata); 36 - handler's return value signature char (see dyncall_signature.h) of callback's return value type
37 - callback return value is written to the corresponding type's field of result
38 - if callback return value is an aggregate (by value), use dcbReturnAggr() as a helper to write to result
39 */
40 typedef DCsigchar (DCCallbackHandler)(DCCallback* pcb, DCArgs* args, DCValue* result, void* userdata);
37 41
38 #ifdef __cplusplus 42 #ifdef __cplusplus
39 extern "C" { 43 extern "C" {
40 #endif 44 #endif
41 45
42 DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* funcptr, void* userdata); 46 DCCallback* dcbNewCallback (const DCsigchar* signature, DCCallbackHandler* funcptr, void* userdata);
43 void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata); 47 DCCallback* dcbNewCallback2 (const DCsigchar* signature, DCCallbackHandler* funcptr, void* userdata, DCaggr *const * aggrs);
44 void dcbFreeCallback(DCCallback* pcb); 48 void dcbInitCallback (DCCallback* pcb, const DCsigchar* signature, DCCallbackHandler* handler, void* userdata);
45 void* dcbGetUserData (DCCallback* pcb); 49 void dcbInitCallback2(DCCallback* pcb, const DCsigchar* signature, DCCallbackHandler* handler, void* userdata, DCaggr *const * aggrs);
50 void dcbFreeCallback (DCCallback* pcb);
51 void* dcbGetUserData (DCCallback* pcb);
46 52
47 #ifdef __cplusplus 53 #ifdef __cplusplus
48 } 54 }
49 #endif 55 #endif
50 56
51 #endif /* DYNCALL_CALLBACK_H */ 57 #endif /* DYNCALL_CALLBACK_H */
58