pass -static-libstdc++ via LDFLAGS
[AROS.git] / rom / exec / findresident.c
blob58396683138bf25dcc22c6d15a0325b35b8baf48
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Search a resident module by name
6 Lang: english
7 */
9 #include <string.h>
10 #include <exec/resident.h>
11 #include <proto/exec.h>
13 #include "exec_debug.h"
14 #include "exec_intern.h"
15 #include "exec_util.h"
17 /*****************************************************************************
19 NAME */
21 AROS_LH1(struct Resident *, FindResident,
23 /* SYNOPSIS */
24 AROS_LHA(const UBYTE *, name, A1),
26 /* LOCATION */
27 struct ExecBase *, SysBase, 16, Exec)
29 /* FUNCTION
30 Search for a Resident module in the system resident list.
32 INPUTS
33 name - pointer to the name of a Resident module to find
35 RESULT
36 pointer to the Resident module (struct Resident *), or null if
37 not found.
39 NOTES
41 EXAMPLE
43 BUGS
45 SEE ALSO
47 INTERNALS
49 *****************************************************************************/
51 AROS_LIBFUNC_INIT
53 IPTR *ptr;
55 DFINDRESIDENT("FindResident(\"%s\")", name);
57 ptr = InternalFindResident(name, SysBase->ResModules);
58 if (ptr)
60 DFINDRESIDENT("Found at 0x%p", *ptr);
61 return (struct Resident *)*ptr;
64 DFINDRESIDENT("Not found");
65 return NULL;
67 AROS_LIBFUNC_EXIT
68 } /* FindResident */
70 IPTR *InternalFindResident(const UBYTE *name, IPTR *list)
72 if (list)
74 while (*list)
77 * On amiga, if bit 31 is set then this points to another list of
78 * modules rather than pointing to a single module. bit 31 is
79 * inconvenient on architectures where code may be loaded above
80 * 2GB. on these platforms we assume aligned pointers and use bit
81 * 0 instead
83 if (*list & RESLIST_NEXT)
85 list = (IPTR *)(*list & ~RESLIST_NEXT);
86 continue;
89 if (!(strcmp( ((struct Resident *)*list)->rt_Name, name)))
90 return list;
92 list++;
95 return NULL;