Mercurial > pub > dyncall > dyncall
diff test/callback_suite/README.txt @ 0:3e629dc19168
initial from svn dyncall-1745
author | Daniel Adler |
---|---|
date | Thu, 19 Mar 2015 22:24:28 +0100 |
parents | |
children | 45ac093ca822 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/callback_suite/README.txt Thu Mar 19 22:24:28 2015 +0100 @@ -0,0 +1,66 @@ +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 cominations of types +and argument position. +See env.* files for details. + + +Reference argument and result value + +The value is generated by a pure function GetReferenceValue and +GetReferenceResult (file env.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 env.c. + +Tssting for exotic calling conventions on Windows: + +Specify 'api' and 'ccprefix' accordingly: + + +"__stdcall" "_s" +"__fastcall" "_f" for gcc compiler + "_F" for microsoft compiler + + +