| M O D _ A D D D I S K M O D U L E ( )
| | | | | SOURCE: qdev_autodocs.txt 1.163 (12/09/2014) English
AMIGA - MOD_#?
----------------------------------------------------------------------------
NAME
mod_adddiskmodule() - Load and add module to the OS.
SYNOPSIS
kh = mod_adddiskmodule(fd, af);
void *mod_adddiskmodule(LONG, struct mod_adi_feed *);
FUNCTION
Basically this function allows to load any Amiga hunk
file that contains Resident(ROMTAG) structure. Usual
stuff like: libraries, devices and some resources can
be loaded with no prob.
INPUTS
fd - FileHandle as obtained with 'Open()' or virtual
file handler.
af - Disk module feed structure.
RETURNS
Returns pointer to the allocation/module or NULL upon
failure.
BASES
SysBase, DOSBase
NOTES
'struct mod_adi_feed' is described in the qdev.h file.
Member 'kh_ml.ml_Node.ln_Name' points at table of two
LONGs where the very first one is the seglist and the
other volatile result of 'mem_codereloc()' which will
become invalid after reboot!
This func. does check if module is already in memory.
See file that describes structures for more info.
SEE ALSO
mod_deldiskmodule()
EXAMPLE
...
#include <qdev.h>
...
struct mod_adi_feed af;
void *kh;
LONG fd;
af.af_memflags = MEMF_LOCAL;
af.af_memstart = QDEV_MOD_ADE_24BITLOWER;
af.af_memend = QDEV_MOD_ADE_32BITUPPER;
af.af_flags = 0;
af.af_error = 0;
if ((fd = Open("LIBS:version.library", MODE_OLDFILE)))
{
if ((kh = mod_adddiskmodule(fd, &af)))
{
/*
* Pressing Ctrl-E unloads the module right away.
*/
Wait(SIGBREAKF_CTRL_E);
mod_deldiskmodule(kh);
}
else
{
FPrintf(Output(), "%ld\n", af->af_error);
}
Close(fd);
}
BUGS
None known.
----------------------------------------------------------------------------
| |
| |