| M E M _ A T T A C H R E L H O T V E C ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
AMIGA - MEM_#?
----------------------------------------------------------------------------
NAME
mem_attachrelhotvec() - Allocates and attaches hot vector
array in relation to wrapper fp.
SYNOPSIS
hot = mem_attachrelhotvec(fp, size);
void *mem_attachrelhotvec(void *, LONG);
FUNCTION
This func. allocates and attaches "hot vector" array to a
task (wrapper code relative) so that programmer can pass
pointers of variables to callbacks/hooks that do not take
data pointer. All within current task.
INPUTS
fp - Function pointer of wrapper responsible for hot
vector array recovery.
size - Size of the array. Stuffing anything below 4 will
result in an array of at least 4 vectors.
RETURNS
Function returns pointer to MemList or NULL upon failure.
Member 'ml_ME[0].me_Addr' points at the vector root data.
BASES
SysBase
NOTES
See notes of 'mem_attachhotvec()' func. for more details.
This function is a wrapper on top of real allocator that
is able to translate function pointer to upper id values.
No id collision is possible under normal usage.
SEE ALSO
mem_attachhotvec(), mem_detachhotvec(),
mem_obtainhotvec(), mem_obtainrelhotvec(),
mem_resolvehotvec()
EXAMPLE
/*
* Create wrapper function that will be unique in itself
* then return with function that obtains hot vec. This
* is your hot vector resolver from now on.
*/
__interrupt LONG **gethotvec00(LONG ent)
{
return mem_obtainrelhotvec(gethotvec00, ent);
}
int main(void)
{
void *hot;
LONG **vec;
/*
* Allocate hot vector array of size 16 in a relative
* way. Func. pointer will be translated into dynamic
* id.
*/
if ((hot = mem_attachrelhotvec(gethotvec00, 16)))
{
/*
* Obtain address to top of the hot vector array.
*/
vec = gethotvec00(0);
vec[0] = (LONG *)<my addr 1>;
vec[1] = (LONG *)<my addr 2>;
...
mem_detachhotvec(hot);
}
return 0;
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |