1Compiling CVS mosml on swallow 2002-04-07
2-----------------------------------------
3
4Makefile.inc:
5
6gcc -> cc
7
8remove dynlib.c:
9
10#ADDPRIMS=dynlib.c
11#ADDOBJS=dynlib.o
12#ADDRUNLIBS=-ldl
13#ADDRUNCFLAGS=
14#ADDDYNLIBCFLAGS=
15
16
17Preprocessor complains, then automatically switches to -traditional or
18whatever.
19
20
21~/bin is on PATH, but the shell needs a rehash to be able to find
22newly installed programs there.
23
24
25mosmllib/test failures:
26
27filesys:
28
29test6e
30  -- succeeds, should fail?
31
32test6f
33  -- succeeds, should fail?
34
35test8d
36  -- succeeds, should fail? --- boils down to test6e
37
38test8h
39  -- succeeds, should fail? --- boils down to test6f
40
41
42Dynamic linking
43---------------
44
45man 3 dyld:
46
47DYLD(3)                                                   DYLD(3)
48
49
50
51NAME
52       dyld - low level programatic interface to the dynamic link
53       editor
54
55SYNOPSIS
56       #include <mach-o/dyld.h>
57       unsigned long _dyld_present(void);
58       unsigned long _dyld_image_count(void);
59       struct mach_header *_dyld_get_image_header(
60            unsigned long image_index);
61       unsigned long _dyld_get_image_vmaddr_slide(
62            unsigned long image_index);
63       char *_dyld_get_image_name(
64            unsigned long image_index);
65       void _dyld_lookup_and_bind(
66            char *symbol_name,
67            unsigned long *address,
68            void **module);
69       void _dyld_lookup_and_bind_with_hint(
70            char *symbol_name,
71            const char *library_name_hint,
72            unsigned long *address,
73            void **module);
74       void _dyld_lookup_and_bind_fully(
75            char *symbol_name,
76            unsigned long *address,
77            void **module);
78       enum bool _dyld_bind_fully_image_containing_address(
79            unsigned long *address);
80       enum bool _dyld_image_containing_address(
81            unsigned long address);
82       enum bool _dyld_launched_prebound(void);
83       int _dyld_func_lookup(
84            char *dyld_func_name,
85            unsigned long *address);
86       extern void _dyld_bind_objc_module(
87            void *objc_module);
88       extern void _dyld_get_objc_module_sect_for_module(
89            NSModule module,
90            void **objc_module,
91            unsigned long *size);
92       extern void _dyld_lookup_and_bind_objc(
93            const char *symbol_name,
94            unsigned long *address,
95            void **module);
96       extern void _dyld_moninit(
97            void (*monaddition)(char *lowpc, char *highpc));
98
99       extern void _dyld_register_func_for_add_image(
100            void (*func)(struct mach_header *mh, unsigned long vmaddr_slide));
101       extern void _dyld_register_func_for_remove_image(
102            void (*func)(struct mach_header *mh, unsigned long vmaddr_slide));
103       extern void _dyld_register_func_for_link_module(
104            void (*func)(NSModule module));
105
106DESCRIPTION
107       These routines are the low level programatic interface  to
108       the dynamic link editor.
109
110       _dyld_present  returns  non-zero  if the dynamic linker is
111       being used in the program and  zero  otherwise.   If  this
112       returns  zero  this  rest of these functions should not be
113       called and most likely crash the program if called.
114
115       _dyld_image_count returns the  current  number  of  images
116       mapped in by the dynamic link editor.
117
118       _dyld_get_image_header  returns  the  mach  header  of the
119       image indexed by image_index.  If image_index  is  out  of
120       range NULL is returned.
121
122       _dyld_get_image_vmaddr_slide  returns  the virtural memory
123       address slide amount of the image indexed by  image_index.
124       If image_index is out of range zero is returned.
125
126       _dyld_get_image_name returns the name of the image indexed
127       by image_index.  If image_index is out of  range  NULL  is
128       returned.
129
130       _dyld_lookup_and_bind  looks  up the symbol_name and binds
131       it into the program.  It indirectly  returns  the  address
132       and and a pointer to the module that defined the symbol.
133
134       _dyld_lookup_and_bind_with_hint    is    the    same    as
135       _dyld_lookup_and_bind but the library_name_hint  parameter
136       provides  a hint as to where to start the lookup in a pre-
137       bound program.  The library_name_hint parameter is matched
138       up with the actual library install names with strstr(3).
139
140       _dyld_lookup_and_bind_fully  looks  up the symbol_name and
141       binds it and all of its references into the  program.   It
142       indirectly  returns  the  address and and a pointer to the
143       module that defined the symbol.
144
145       _dyld_bind_fully_image_containing_address fully binds  the
146       image  containing  the specified address.  It returns TRUE
147       if the address is contained in a loaded  image  and  FALSE
148       otherwise.
149
150       _dyld_image_containing_address  It  returns  TRUE  if  the
151       address is contained an image dyld loaded and FALSE other-
152       wise.
153
154       _dyld_launched_prebound  returns  TRUE  if the program was
155       launched using the prebound state and FALSE otherwise.
156
157       _dyld_func_lookup is passed a name, dyld_func_name,  of  a
158       dynamic  link  editor  function and returns the address of
159       the function indirectly.  It returns non-zero if the func-
160       tion is found and zero otherwise.
161
162       _dyld_bind_objc_module is passed a pointer to something in
163       an (__OBJC,__module) section and causes the module that is
164       associated with that address to be bound.
165
166       _dyld_get_objc_module_sect_for_module  is  passed a module
167       and sets a pointer to the  (__OBJC,__module)  section  and
168       its size for the specified module.
169
170       _dyld_lookup_and_bind_objc()     is     the     same    as
171       _dyld_lookup_and_bind() but does  not  update  the  symbol
172       pointers  if  the symbol is in a bound module.  The reason
173       for    this    is    that    an    objc    symbol     like
174       .objc_class_name_Object is never used by a symbol pointer.
175       Since this is done a lot by the objc runtime and  updating
176       symbol pointers is not cheep it should not be done.
177
178       _dyld_moninit is called from the profiling runtime routine
179       moninit(3) to cause the dyld loaded code to  be  profiled.
180       It  is  passed a pointer to the the profiling runtime rou-
181       tine monaddtion(3) to be called after an  image  had  been
182       mapped in.
183
184       _dyld_register_func_for_add_image  registers the specified
185       function to be called when a new image is added (a  bundle
186       or  a  dynamic  shared library) to the program.  When this
187       function is first registered it is  called  for  once  for
188       each image that is currently part of the program.
189
190       _dyld_register_func_for_remove_image  registers the speci-
191       fied function to be called when an  image  is  removed  (a
192       bundle  or  a  dynamic  shared  library) from the program.
193       _dyld_register_func_for_link_module registers  the  speci-
194       fied function to be called when a module is bound into the
195       program.  When this function is  first  registered  it  is
196       called  for  once  for each module that is currently bound
197       into the program.
198
199Apple Computer, Inc.    November 22, 2000                 DYLD(3)
200