Mercurial > pub > dyncall > dyncall
view test/callback_suite/README.txt @ 505:049e04af13c8
test/callback_suite:
- greatly simplified
- refactored to look more like other test cases (especially call_suite{,_aggrs} for consistency/maintainablity/future code sharing
author | Tassilo Philipp |
---|---|
date | Sat, 09 Apr 2022 13:53:58 +0200 |
parents | 45ac093ca822 |
children | 5a3c07a0f376 |
line wrap: on
line source
Callback Test Suite 2 --------------------- REQUIREMENTS - dyncall - ANSI C compiler - lua (tested with 5.1) CONFIGURE SUITE edit config.lua and run "make config". DESCRIPTION Generates a set of callback invokers in C using lua as a preprocessor. The invokers put up an argument vector using a global Value-Matrix which holds a specific type-specific value pattern as a function of position. The Value-Matrix The value-matrix is a data structure consisting of n x m elements of type DCValueSet which can store distinct numbers for each type. It is used in the body of the auto-generated callback invokers (C code). The Callback Invocation Body Example: The body for a signature of type "dpdf)p" at case id 19 is: void f19(void* addr) { Result.p = ((CONFIG_API p(*)(d,p,d,f))addr)(ValueMatrix[0].d,ValueMatrix[1].p,ValueMatrix[2].d,ValueMatrix[3].f); } ^^^^^^^^^^- calling convention ^^^^^^^^^^^^^- signature ^- return type signature ^- arg signature char 0 (later expected) value Result (type DCValue) and ValueMatrix (type DCValueSet[MAXARGS]) are globals. The ValueMatrix is initialized once from main.c for all combinations of types and argument position. See globals.* files for details. Reference argument and result value The value is generated by a pure function get_reference_arg and get_reference_result (file globals.c). They have formals position and type and are pure without any side-effects (means the function value does only relay on the input arguments - if called with same arguments it will reveal the same value. It defined in globals.c. Tssting for exotic calling conventions on Windows: Specify 'api' and 'ccprefix' accordingly: "__stdcall" "_s" "__fastcall" "_f" for gcc compiler "_F" for microsoft compiler @@@STRUCT review