Mercurial > pub > dyncall > dyncall
comparison dyncallback/dyncallback.3 @ 96:95f67e67feb0
- updated dyncallback.3, blurb about handler's retval signature character was outdated
author | cslag |
---|---|
date | Sat, 04 Jun 2016 19:32:21 +0200 |
parents | dfde5035d410 |
children | 7cb8a0aaf638 |
comparison
equal
deleted
inserted
replaced
95:9e99918065e6 | 96:95f67e67feb0 |
---|---|
37 dynamically over the arguments once called back. | 37 dynamically over the arguments once called back. |
38 .Pp | 38 .Pp |
39 .Fn dcbNewCallback | 39 .Fn dcbNewCallback |
40 creates a new callback object, where | 40 creates a new callback object, where |
41 .Ar signature | 41 .Ar signature |
42 is a signature string describing the function to be called back (see manual for | 42 is a signature string describing the function to be called back (see manual or |
43 format). This is needed for | 43 dyncall_signature.h for format). This is needed for |
44 .Nm | 44 .Nm |
45 dyncallback to correctly prepare the arguments passed in by the function that | 45 dyncallback to correctly prepare the arguments passed in by the function that |
46 calls the callback handler. Note that the handler doesn't return the value | 46 calls the callback handler. Note that the handler doesn't return the value |
47 specified in the signature, directly, but simply 'i' or 'f' depending on whether | 47 specified in the signature, directly, but a signature character, specifying the |
48 it is a integral or floating point type. The return value itself is stored | 48 return value's type. |
49 where the handler's 3rd parameter points to (see example). | 49 The return value itself is stored where the handler's |
50 3rd parameter points to (see below). | |
50 .Ar funcptr | 51 .Ar funcptr |
51 is a pointer to the | 52 is a pointer to the |
52 .Nm | 53 .Nm |
53 dyncallback callback handler (see below), and | 54 dyncallback callback handler (see below), and |
54 .Ar userdata | 55 .Ar userdata |
104 long long arg5 = dcbArgLongLong(args); | 105 long long arg5 = dcbArgLongLong(args); |
105 | 106 |
106 // .. do something .. | 107 // .. do something .. |
107 | 108 |
108 result->s = 1244; | 109 result->s = 1244; |
109 return 'i'; | 110 return 's'; |
110 } | 111 } |
111 .Ed | 112 .Ed |
112 .Pp | 113 .Pp |
113 Note that the return value of the handler is a signature character, not the | 114 Note that the return value of the handler is a signature character, not the |
114 actual return value, itself, and note that the actual return value is of type | 115 actual return value, itself. |
115 short. | |
116 Now, let's call it through a DCCallback object: | 116 Now, let's call it through a DCCallback object: |
117 .Bd -literal -offset indent | 117 .Bd -literal -offset indent |
118 DCCallback* cb; | 118 DCCallback* cb; |
119 short result = 0; | 119 short result = 0; |
120 int userdata = 1337; | 120 int userdata = 1337; |