author | Claus Gittinger <cg@exept.de> |
Tue, 21 May 2013 22:27:25 +0200 | |
changeset 3172 | 4ec2075f49ed |
parent 3154 | 9fb144482c78 |
child 3177 | 64cd3b90f22c |
permissions | -rw-r--r-- |
0 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
45 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
1116
4cadfbecca99
methods send category-change notifications themself
Claus Gittinger <cg@exept.de>
parents:
1033
diff
changeset
|
12 |
"{ Package: 'stx:libcomp' }" |
4cadfbecca99
methods send category-change notifications themself
Claus Gittinger <cg@exept.de>
parents:
1033
diff
changeset
|
13 |
|
0 | 14 |
Object subclass:#ObjectFileLoader |
174 | 15 |
instanceVariableNames:'' |
16 |
classVariableNames:'MySymbolTable Verbose LastError LinkErrorMessage NextHandleID |
|
149
3dc42a5ab417
default for SearchedLibraries
Claus Gittinger <cg@exept.de>
parents:
148
diff
changeset
|
17 |
LoadedObjects PreviouslyLoadedObjects ActuallyLoadedObjects |
2982 | 18 |
ErrorPrinting LastErrorNumber OldSpaceReserve |
19 |
CopyLibrariesWhenLoading' |
|
174 | 20 |
poolDictionaries:'' |
21 |
category:'System-Compiler' |
|
47 | 22 |
! |
23 |
||
2627
a34348df953a
changed: #createLoadableObjectFor:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
24 |
Error subclass:#ObjectFileLoadError |
a34348df953a
changed: #createLoadableObjectFor:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
25 |
instanceVariableNames:'' |
a34348df953a
changed: #createLoadableObjectFor:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
26 |
classVariableNames:'' |
a34348df953a
changed: #createLoadableObjectFor:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
27 |
poolDictionaries:'' |
a34348df953a
changed: #createLoadableObjectFor:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
28 |
privateIn:ObjectFileLoader |
a34348df953a
changed: #createLoadableObjectFor:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
29 |
! |
a34348df953a
changed: #createLoadableObjectFor:
Claus Gittinger <cg@exept.de>
parents:
2492
diff
changeset
|
30 |
|
2284
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
31 |
Notification subclass:#ObjectFileLoadErrorNotification |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
32 |
instanceVariableNames:'' |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
33 |
classVariableNames:'' |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
34 |
poolDictionaries:'' |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
35 |
privateIn:ObjectFileLoader |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
36 |
! |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
37 |
|
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
38 |
ObjectFileLoader::ObjectFileLoadErrorNotification subclass:#RegistrationFailedErrorNotification |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
39 |
instanceVariableNames:'' |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
40 |
classVariableNames:'' |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
41 |
poolDictionaries:'' |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
42 |
privateIn:ObjectFileLoader |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
43 |
! |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
44 |
|
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
45 |
ObjectFileLoader::ObjectFileLoadErrorNotification subclass:#SuperClassMissingErrorNotification |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
46 |
instanceVariableNames:'' |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
47 |
classVariableNames:'' |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
48 |
poolDictionaries:'' |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
49 |
privateIn:ObjectFileLoader |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
50 |
! |
ace9886a301e
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2256
diff
changeset
|
51 |
|
53 | 52 |
!ObjectFileLoader primitiveDefinitions! |
0 | 53 |
%{ |
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
54 |
|
2999 | 55 |
#undef true |
56 |
#undef false |
|
57 |
||
15 | 58 |
/* |
59 |
* by default, use whatever the system provides |
|
60 |
*/ |
|
182
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
61 |
#if defined(SYSV4) || defined(HAS_DLOPEN) /* sys5.4 dlopen interface */ |
15 | 62 |
# define SYSV4_DL |
20 | 63 |
# define HAS_DL |
15 | 64 |
#endif |
65 |
||
609 | 66 |
#ifdef __VMS__ |
67 |
# undef __new |
|
68 |
#endif |
|
69 |
||
95 | 70 |
#ifdef DL1_6 /* dl1.6 COFF loader */ |
71 |
# define HAS_DL |
|
72 |
#endif |
|
73 |
||
20 | 74 |
#include <stdio.h> |
75 |
||
95 | 76 |
#ifdef NEXT_DL |
77 |
# ifndef _RLD_H_ |
|
78 |
# define _RLD_H_ |
|
125 | 79 |
# ifdef NEXT3 |
80 |
# include <mach-o/rld.h> |
|
81 |
# else |
|
82 |
# include <rld.h> |
|
83 |
# endif |
|
95 | 84 |
# endif |
85 |
#endif /* NEXT_DL */ |
|
86 |
||
28 | 87 |
#ifdef SYSV4_DL |
1903 | 88 |
# ifndef dlfcn_h |
89 |
# include <dlfcn.h> |
|
90 |
# define dlfcn_h |
|
91 |
# endif |
|
28 | 92 |
#endif |
93 |
||
45 | 94 |
#ifdef GNU_DL |
95 |
# ifndef dld_h |
|
96 |
# include "dld.h" |
|
97 |
# define dld_h |
|
98 |
# endif |
|
99 |
#endif |
|
95 | 100 |
|
101 |
#ifdef DL1_6 |
|
102 |
# ifndef dl_h |
|
103 |
# include "dl.h" |
|
104 |
# define dl_h |
|
105 |
# endif |
|
106 |
#endif |
|
107 |
||
97 | 108 |
#ifdef AIX_DL |
109 |
# include <nlist.h> |
|
100 | 110 |
# include <sys/ldr.h> |
111 |
# include <errno.h> |
|
97 | 112 |
#endif |
180 | 113 |
|
523 | 114 |
#ifdef HPUX10_DL |
1903 | 115 |
# ifndef dl_h |
116 |
# include <dl.h> |
|
117 |
# define dl_h |
|
118 |
# endif |
|
524 | 119 |
# include <errno.h> |
523 | 120 |
#endif |
121 |
||
906 | 122 |
#ifdef BEOS_DL |
123 |
# include <be/kernel/image.h> |
|
124 |
#endif |
|
125 |
||
180 | 126 |
#ifdef WIN_DL |
1906 | 127 |
# undef INT |
2993 | 128 |
# undef UINT |
1906 | 129 |
# undef Array |
130 |
# undef Number |
|
131 |
# undef Method |
|
132 |
# undef Block |
|
133 |
# undef Time |
|
134 |
# undef Date |
|
135 |
# undef Set |
|
136 |
# undef Delay |
|
137 |
# undef Signal |
|
138 |
# undef Context |
|
2114 | 139 |
# undef Message |
140 |
# undef Process |
|
141 |
# undef Processor |
|
2919 | 142 |
# undef Rectangle |
2993 | 143 |
# undef String |
144 |
# undef Character |
|
145 |
# undef Point |
|
146 |
# undef Object |
|
1906 | 147 |
|
148 |
# ifdef __i386__ |
|
149 |
# ifndef _X86_ |
|
150 |
# define _X86_ |
|
729 | 151 |
# endif |
1906 | 152 |
# endif |
153 |
||
154 |
# ifdef __BORLANDC__ |
|
155 |
# define NOATOM |
|
156 |
# define NOUSER |
|
157 |
# define NOGDI |
|
158 |
# define NOGDICAPMASKS |
|
159 |
# define NOMETAFILE |
|
160 |
# define NOMINMAX |
|
161 |
# define NOMSG |
|
162 |
# define NOOPENFILE |
|
163 |
# define NORASTEROPS |
|
164 |
# define NOSCROLL |
|
165 |
# define NOSOUND |
|
166 |
# define NOSYSMETRICS |
|
167 |
# define NOTEXTMETRIC |
|
168 |
# define NOWH |
|
169 |
# define NOCOMM |
|
170 |
# define NOKANJI |
|
171 |
# define NOCRYPT |
|
172 |
# define NOMCX |
|
173 |
# define WIN32_LEAN_AND_MEAN |
|
2920 | 174 |
# include <windows.h> |
175 |
// # include <windef.h> |
|
176 |
// # include <winbase.h> |
|
1906 | 177 |
# else |
2919 | 178 |
# ifdef __VISUALC__ |
2920 | 179 |
// # include <windows.h> |
180 |
# include <windef.h> |
|
181 |
# include <winbase.h> |
|
2919 | 182 |
# else |
2920 | 183 |
# include <windows.h> |
2919 | 184 |
# endif |
185 |
# endif /* BORLANDC */ |
|
186 |
||
1906 | 187 |
|
188 |
# ifdef __DEF_Array |
|
189 |
# define Array __DEF_Array |
|
190 |
# endif |
|
191 |
# ifdef __DEF_Number |
|
192 |
# define Number __DEF_Number |
|
193 |
# endif |
|
194 |
# ifdef __DEF_Method |
|
195 |
# define Method __DEF_Method |
|
196 |
# endif |
|
197 |
# ifdef __DEF_Block |
|
198 |
# define Block __DEF_Block |
|
199 |
# endif |
|
200 |
# ifdef __DEF_Time |
|
201 |
# define Time __DEF_Time |
|
202 |
# endif |
|
203 |
# ifdef __DEF_Date |
|
204 |
# define Date __DEF_Date |
|
205 |
# endif |
|
1010 | 206 |
# ifdef __DEF_Set |
207 |
# define Set __DEF_Set |
|
208 |
# endif |
|
209 |
# ifdef __DEF_Signal |
|
210 |
# define Signal __DEF_Signal |
|
211 |
# endif |
|
212 |
# ifdef __DEF_Delay |
|
213 |
# define Delay __DEF_Delay |
|
214 |
# endif |
|
1175 | 215 |
# ifdef __DEF_Context |
216 |
# define Context __DEF_Context |
|
217 |
# endif |
|
2114 | 218 |
# ifdef __DEF_Message |
219 |
# define Message __DEF_Message |
|
220 |
# endif |
|
221 |
# ifdef __DEF_Process |
|
222 |
# define Process __DEF_Process |
|
223 |
# endif |
|
224 |
# ifdef __DEF_Processor |
|
225 |
# define Processor __DEF_Processor |
|
226 |
# endif |
|
2919 | 227 |
# ifdef __DEF_Rectangle |
228 |
# define Rectangle __DEF_Rectangle |
|
229 |
# endif |
|
2993 | 230 |
# ifdef __DEF_String |
231 |
# define String __DEF_String |
|
232 |
# endif |
|
233 |
# ifdef __DEF_Character |
|
234 |
# define Character __DEF_Character |
|
235 |
# endif |
|
236 |
# ifdef __DEF_Point |
|
237 |
# define Point __DEF_Point |
|
238 |
# endif |
|
239 |
# ifdef __DEF_Object |
|
240 |
# define Object __DEF_Object |
|
241 |
# endif |
|
242 |
||
243 |
||
244 |
# define INT STX_INT |
|
245 |
# define UINT STX_UINT |
|
1974 | 246 |
|
729 | 247 |
#endif /* WIN_DL */ |
1906 | 248 |
|
2998 | 249 |
#undef true |
250 |
#define true __STX_true |
|
2999 | 251 |
|
2998 | 252 |
#undef false |
253 |
#define false __STX_false |
|
254 |
||
0 | 255 |
%} |
20 | 256 |
! ! |
257 |
||
369 | 258 |
!ObjectFileLoader class methodsFor:'documentation'! |
141 | 259 |
|
260 |
copyright |
|
261 |
" |
|
262 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
263 |
All Rights Reserved |
|
264 |
||
265 |
This software is furnished under a license and may be used |
|
266 |
only in accordance with the terms of that license and with the |
|
267 |
inclusion of the above copyright notice. This software may not |
|
268 |
be provided or otherwise made available to, or used by, any |
|
269 |
other person. No title to or ownership of the software is |
|
270 |
hereby transferred. |
|
271 |
" |
|
272 |
! |
|
273 |
||
274 |
documentation |
|
275 |
" |
|
276 |
This class knowns how to dynamically load in external object-modules. |
|
277 |
||
278 |
WARNING: |
|
809 | 279 |
As to date, this is still experimental and WITHOUT ANY WARRANTY. |
280 |
It is still being developed and the code may need some cleanup and more |
|
141 | 281 |
robustness. |
282 |
||
283 |
There are basically two totally different mechanisms to do this: |
|
846
8d1a4228c0e3
win32 error message if LoadLibrary fails
Claus Gittinger <cg@exept.de>
parents:
845
diff
changeset
|
284 |
a) if there exists some dynamic-link facility such as: |
8d1a4228c0e3
win32 error message if LoadLibrary fails
Claus Gittinger <cg@exept.de>
parents:
845
diff
changeset
|
285 |
GNU-DL, dlopen (sparc, SYS5.4), rld_open (NeXT), |
8d1a4228c0e3
win32 error message if LoadLibrary fails
Claus Gittinger <cg@exept.de>
parents:
845
diff
changeset
|
286 |
or LoadLibrary (Win32), this is used |
8d1a4228c0e3
win32 error message if LoadLibrary fails
Claus Gittinger <cg@exept.de>
parents:
845
diff
changeset
|
287 |
|
8d1a4228c0e3
win32 error message if LoadLibrary fails
Claus Gittinger <cg@exept.de>
parents:
845
diff
changeset
|
288 |
b) if no such facility exists, the normal linker is used to |
8d1a4228c0e3
win32 error message if LoadLibrary fails
Claus Gittinger <cg@exept.de>
parents:
845
diff
changeset
|
289 |
link the module to text/data address as previously malloced, |
8d1a4228c0e3
win32 error message if LoadLibrary fails
Claus Gittinger <cg@exept.de>
parents:
845
diff
changeset
|
290 |
and the object file loaded into that space. |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
291 |
|
141 | 292 |
Currently, not all mechanisms work fully satisfying. |
293 |
For example, the sun dl*-functions do an exit on link-errors (which |
|
294 |
is certainly not what we want here :-(; the NeXT mechanism does not |
|
845 | 295 |
allow for selective unloading (only all or the last loaded module). |
296 |
||
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
297 |
The only really useful packages are the GNU-dl package, |
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
298 |
the SGI/Unixware/sys5.4/linux libdl packages and the win32 dll's. |
809 | 299 |
The GNU-dl package is only available for a.out file formats |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
300 |
(which is more or less obsolete); |
809 | 301 |
|
141 | 302 |
For the above reasons, dynamic object loading is currently only |
845 | 303 |
officially released for SYS5.4-based, LINUX and win32 systems. |
141 | 304 |
|
305 |
Once stable, the functionality contained herein will be moved into |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
306 |
the VM. |
141 | 307 |
(It is needed there, to allow reloading of objectfiles upon |
308 |
image restart; i.e. before any class is reinitialilized). |
|
263 | 309 |
|
809 | 310 |
Right now, reloading of object files is done by smalltalk code, |
311 |
which fails, if code is to be loaded which is required before the |
|
312 |
load takes place, or which is used by the loader itself. |
|
313 |
(i.e. for now, many primitives from libbasic cannot be dynamically |
|
314 |
loaded at image restart time). |
|
315 |
||
263 | 316 |
[author:] |
846
8d1a4228c0e3
win32 error message if LoadLibrary fails
Claus Gittinger <cg@exept.de>
parents:
845
diff
changeset
|
317 |
Claus Gittinger |
141 | 318 |
" |
319 |
! ! |
|
320 |
||
369 | 321 |
!ObjectFileLoader class methodsFor:'initialization'! |
0 | 322 |
|
323 |
initialize |
|
1659 | 324 |
|systemType libDir linkCommand linkArgs libPath searchedLibraries| |
0 | 325 |
|
2746
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
326 |
Verbose := false. |
2745 | 327 |
"/ Verbose := true. |
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
328 |
|
759 | 329 |
OperatingSystem isMSDOSlike ifTrue:[ |
2993 | 330 |
"/ default setup for msc |
331 |
ParserFlags useBorlandC ifTrue:[ |
|
332 |
libDir := '..\lib\bc'. |
|
333 |
libDir asFilename exists ifFalse:[ |
|
334 |
libDir := '..\lib\lib\bc'. |
|
335 |
libDir asFilename exists ifFalse:[ |
|
336 |
libDir := '..\lib'. |
|
337 |
] |
|
338 |
]. |
|
339 |
||
340 |
linkCommand isNil ifTrue:[ |
|
341 |
"/ linkCommand := 'tlink32'. |
|
342 |
linkCommand := 'ilink32'. |
|
343 |
]. |
|
344 |
linkArgs isNil ifTrue:[ |
|
345 |
"/ linkArgs := '-L',libDir,' -L\Programme\Borland\CBuilder3\lib -c -ap -Tpd -s -Gi -v -w-dup ',libDir,'\librun.lib'. |
|
346 |
linkArgs := '-L',libDir,' -L\Programme\Borland\CBuilder3\lib -r -c -ap -Tpd -Gi -w-dup'. |
|
347 |
]. |
|
348 |
searchedLibraries := #( |
|
349 |
'import32.lib' |
|
350 |
). |
|
351 |
] ifFalse:[ |
|
352 |
linkCommand isNil ifTrue:[ |
|
353 |
linkCommand := 'link' |
|
354 |
]. |
|
355 |
linkArgs isNil ifTrue:[ |
|
356 |
linkArgs := '/NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL /OUT:%1.dll /DEF:%1.def' |
|
357 |
]. |
|
358 |
]. |
|
759 | 359 |
]. |
360 |
||
201 | 361 |
MySymbolTable isNil ifTrue:[ |
2993 | 362 |
NextHandleID := 1. |
363 |
ObjectMemory addDependent:self. |
|
364 |
||
365 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
366 |
searchedLibraries := #( |
|
367 |
'import32.lib' |
|
368 |
). |
|
369 |
]. |
|
370 |
||
371 |
OperatingSystem isUNIXlike ifTrue:[ |
|
372 |
|ldLibraryPath| |
|
373 |
||
374 |
systemType := OperatingSystem getOSType. |
|
375 |
||
376 |
"/ name of object file, where initial symbol table is found |
|
377 |
"/ not req'd for all architectures. |
|
378 |
||
379 |
MySymbolTable := 'stx'. |
|
380 |
||
381 |
searchedLibraries := #(). |
|
382 |
||
383 |
"/ default libraryPath where shared objects are expected |
|
384 |
"/ when a sharedObject load requires other objects to be loaded. |
|
385 |
"/ For more compatibility with ELF systems, look for a shell variable |
|
386 |
"/ named LD_LIBRARY_PATH, and - if present - take that instead if a default. |
|
387 |
"/ Can (should) be set in the smalltalk.rc file. |
|
388 |
||
389 |
ldLibraryPath := OperatingSystem getEnvironment:'LD_LIBRARY_PATH'. |
|
390 |
ldLibraryPath isEmptyOrNil ifTrue:[ |
|
391 |
libPath := '.:lib:/usr/local/smalltalk/lib:/usr/local/lib:/usr/lib:/lib'. |
|
392 |
] ifFalse:[ |
|
393 |
"/ only needed for AIX - the dynamic linker of other Unixes use LD_LIBRARY_PATH implicitly |
|
394 |
systemType = #aix ifTrue:[ |
|
395 |
libPath := ldLibraryPath. |
|
396 |
]. |
|
397 |
] |
|
398 |
] |
|
1659 | 399 |
]. |
400 |
||
401 |
ParserFlags linkCommand:linkCommand. |
|
402 |
ParserFlags linkArgs:linkArgs. |
|
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
403 |
ParserFlags libPath:libPath ? ''. |
1659 | 404 |
ParserFlags searchedLibraries:searchedLibraries. |
107 | 405 |
|
406 |
" |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
407 |
LinkArgs := LinkCommand := nil. |
107 | 408 |
ObjectFileLoader initialize |
409 |
" |
|
316
ee3426730cfc
on sunos: link dynamic objects against libc.a for unresolved symbols.
Claus Gittinger <cg@exept.de>
parents:
307
diff
changeset
|
410 |
|
2933 | 411 |
"Modified: / 28-09-2012 / 18:19:28 / cg" |
0 | 412 |
! |
413 |
||
141 | 414 |
lastError |
780
294b6775c8ab
show linker error messages (win32)
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
415 |
^ LastError ? 'unknown error' |
294b6775c8ab
show linker error messages (win32)
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
416 |
|
294b6775c8ab
show linker error messages (win32)
Claus Gittinger <cg@exept.de>
parents:
779
diff
changeset
|
417 |
"Modified: / 30.9.1998 / 17:21:23 / cg" |
141 | 418 |
! |
419 |
||
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
420 |
libPath |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
421 |
"see comment in #libPath:" |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
422 |
|
1659 | 423 |
^ ParserFlags libPath |
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
424 |
! |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
425 |
|
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
426 |
libPath:aSharedLibraryPath |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
427 |
"set the pathnames of directories, where other shared objects |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
428 |
are searched, in case a loaded module requires another module shared |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
429 |
library object to be loaded. |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
430 |
Currently, this is only required to be set for AIX systems; |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
431 |
ELF based linux and solaris systems specify the libPath in the |
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
432 |
LD_LIBRARY_PATH environment variable." |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
433 |
|
1659 | 434 |
ParserFlags libPath:aSharedLibraryPath |
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
435 |
|
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
436 |
" |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
437 |
ObjectFileLoader libPath:'.:/usr/lib:/usr/local/lib' |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
438 |
" |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
439 |
! |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
440 |
|
141 | 441 |
linkErrorMessage |
442 |
^ LinkErrorMessage |
|
443 |
! |
|
444 |
||
445 |
searchedLibraries |
|
446 |
"see comment in #searchedLibraries:" |
|
447 |
||
1659 | 448 |
^ ParserFlags searchedLibraries |
141 | 449 |
! |
450 |
||
125 | 451 |
searchedLibraries:aCollectionOfArchivePathNames |
452 |
"set the pathnames of archives which are to be searched |
|
453 |
when unresolved references occur while loading in an object |
|
454 |
file. On systems which support shared libraries (all SYS5.4 based |
|
455 |
systems), this is usually not required. Instead, modules which are to |
|
456 |
be filed in (.so files) are to be prelinked with the appropriate |
|
457 |
shared libraries. The dynamic loader then cares about loading those |
|
458 |
modules (keeping track of which modules are already loaded). |
|
459 |
Only systems in which the dynamic load is done 'manually' by st/x |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
460 |
(i.e. currently only linux and a.out-sunos) need to set this." |
125 | 461 |
|
1659 | 462 |
ParserFlags searchedLibraries:aCollectionOfArchivePathNames |
125 | 463 |
! |
464 |
||
741 | 465 |
verbose |
466 |
"return true, if debug traces are turned on" |
|
467 |
||
468 |
^ Verbose |
|
469 |
! |
|
470 |
||
0 | 471 |
verbose:aBoolean |
472 |
"turn on/off debug traces" |
|
473 |
||
10 | 474 |
Verbose := aBoolean |
0 | 475 |
|
476 |
"ObjectFileLoader verbose:true" |
|
477 |
! ! |
|
478 |
||
2982 | 479 |
!ObjectFileLoader class methodsFor:'accessing'! |
480 |
||
481 |
copyLibrariesWhenLoading |
|
482 |
"under windows, a library file (dll) which has been loaded cannot be overwritten. |
|
483 |
This makes it troublesome, to recompile a new lib while a smalltalk is being executed. |
|
484 |
When CopyLibrariesWhenLoading is true, ddl files are copied to a tempdir before loading, |
|
485 |
so that the original can still be recompiled. |
|
486 |
Makes loading a bit slower (due to copying and less sharing/caching of already loaded dlls), |
|
487 |
so it is of by default and must be turned on explicitly during development." |
|
488 |
||
489 |
^ CopyLibrariesWhenLoading ? false |
|
490 |
||
491 |
" |
|
492 |
self copyLibrariesWhenLoading |
|
493 |
self copyLibrariesWhenLoading:true |
|
494 |
" |
|
495 |
! |
|
496 |
||
497 |
copyLibrariesWhenLoading:aBoolean |
|
498 |
"under windows, a library file (dll) which has been loaded cannot be overwritten. |
|
499 |
This makes it troublesome, to recompile a new lib while a smalltalk is being executed. |
|
500 |
When CopyLibrariesWhenLoading is true, ddl files are copied to a tempdir before loading, |
|
501 |
so that the original can still be recompiled. |
|
502 |
Makes loading a bit slower (due to copying and less sharing/caching of already loaded dlls), |
|
503 |
so it is of by default and must be turned on explicitly during development." |
|
504 |
||
505 |
CopyLibrariesWhenLoading := aBoolean. |
|
506 |
||
507 |
" |
|
508 |
self copyLibrariesWhenLoading:true |
|
509 |
" |
|
510 |
! ! |
|
511 |
||
369 | 512 |
!ObjectFileLoader class methodsFor:'change & update'! |
291 | 513 |
|
514 |
update:something with:aParameter from:changedObject |
|
107 | 515 |
"sent, when image is saved or restarted" |
516 |
||
517 |
(something == #aboutToSnapshot) ifTrue:[ |
|
468 | 518 |
self invalidateAndRememberAllObjectFiles |
125 | 519 |
]. |
520 |
(something == #finishedSnapshot) ifTrue:[ |
|
468 | 521 |
self revalidateAllObjectFiles |
107 | 522 |
]. |
226
f0771f42256d
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
523 |
"/ (something == #restarted) ifTrue:[ |
f0771f42256d
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
524 |
"/ self reloadAllRememberedObjectFiles |
f0771f42256d
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
525 |
"/ ]. |
125 | 526 |
|
527 |
"Modified: 5.10.1995 / 15:49:14 / claus" |
|
226
f0771f42256d
reloadAllObjectFiles now called explicit (its too late via ObjMem changed)
Claus Gittinger <cg@exept.de>
parents:
225
diff
changeset
|
528 |
"Modified: 8.3.1996 / 23:34:29 / cg" |
291 | 529 |
"Created: 21.6.1996 / 19:50:01 / cg" |
107 | 530 |
! ! |
531 |
||
369 | 532 |
!ObjectFileLoader class methodsFor:'defaults'! |
115 | 533 |
|
141 | 534 |
hasValidBinaryExtension:aFilename |
535 |
"return true, if aFilename looks ok for binary loading. |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
536 |
This checks only the extension - not its contents. |
141 | 537 |
(So an attempt to load the file may fail due to format errors or unresolved symbols) |
538 |
This is very machine specific." |
|
539 |
||
1697 | 540 |
|suffix| |
541 |
||
542 |
suffix := aFilename asFilename suffix. |
|
543 |
^ self validBinaryExtensions includes:suffix. |
|
544 |
"/ |fn| |
|
545 |
"/ |
|
546 |
"/ fn := aFilename asFilename. |
|
547 |
"/ self validBinaryExtensions do:[:ext | |
|
548 |
"/ (fn hasSuffix:ext) ifTrue:[^ true]. |
|
549 |
"/ ]. |
|
550 |
"/ ^ false |
|
141 | 551 |
|
552 |
" |
|
553 |
ObjectFileLoader hasValidBinaryExtension:'foo.st' |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
554 |
ObjectFileLoader hasValidBinaryExtension:'foo.o' |
141 | 555 |
ObjectFileLoader hasValidBinaryExtension:'foo.so' |
516 | 556 |
ObjectFileLoader hasValidBinaryExtension:'foo.dll' |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
557 |
ObjectFileLoader hasValidBinaryExtension:'foo.DLL' |
516 | 558 |
ObjectFileLoader hasValidBinaryExtension:'foo.obj' |
741 | 559 |
ObjectFileLoader hasValidBinaryExtension:'foo.sl' |
141 | 560 |
" |
516 | 561 |
|
784
c8742d9efcb6
suffix fix for systems with caseless filenames
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
562 |
"Modified: / 1.10.1998 / 12:47:01 / cg" |
141 | 563 |
! |
564 |
||
759 | 565 |
linkArgs |
1659 | 566 |
^ ParserFlags linkArgs |
759 | 567 |
|
568 |
"Created: / 12.8.1998 / 21:41:16 / cg" |
|
569 |
"Modified: / 12.8.1998 / 21:42:50 / cg" |
|
570 |
! |
|
571 |
||
572 |
linkArgs:anArgString |
|
1659 | 573 |
ParserFlags linkArgs:anArgString |
759 | 574 |
|
575 |
" |
|
576 |
MSC: |
|
1906 | 577 |
ParserFlags linkCommand:'link32'. |
578 |
ParserFlags linkArgs:' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL /OUT:%1.dll /DEF:%1.def' |
|
759 | 579 |
|
580 |
Borland: |
|
1906 | 581 |
ParserFlags linkCommand:'ilink32'. |
582 |
ParserFlags linkArgs:'-ap -E0 -Tpd -s -c -L\Programme\Borland\CBuilder3\lib -L..\libbc librun.lib import32.lib' |
|
759 | 583 |
' |
584 |
'/NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL /OUT:%1.dll /DEF:%1.def' |
|
585 |
||
586 |
Unix: |
|
1906 | 587 |
ParserFlags linkCommand:'ld' |
588 |
ParserFlags linkArgs:'-shared' |
|
759 | 589 |
" |
590 |
||
591 |
"Created: / 12.8.1998 / 21:43:16 / cg" |
|
771 | 592 |
"Modified: / 4.9.1998 / 00:33:46 / cg" |
759 | 593 |
! |
594 |
||
595 |
linkCommand |
|
1659 | 596 |
^ ParserFlags linkCommand |
759 | 597 |
|
598 |
"Created: / 12.8.1998 / 21:41:16 / cg" |
|
599 |
! |
|
600 |
||
601 |
linkCommand:aCommand |
|
1659 | 602 |
ParserFlags linkCommand:aCommand |
759 | 603 |
|
604 |
"Created: / 12.8.1998 / 21:40:44 / cg" |
|
605 |
! |
|
606 |
||
1609
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
607 |
linkSharedArgs |
2651 | 608 |
^ ParserFlags linkSharedArgs |
1609
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
609 |
! |
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
610 |
|
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
611 |
linkSharedArgs:anArgString |
1897 | 612 |
ParserFlags linkSharedArgs:anArgString |
1609
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
613 |
|
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
614 |
" |
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
615 |
Linux on AMD64 in 32bit mode: |
1906 | 616 |
LinkSharedArgs := '-shared -m elf_i386' |
1609
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
617 |
" |
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
618 |
! |
ffccd234a5bb
separate setting for shared-link-arguments
Claus Gittinger <cg@exept.de>
parents:
1608
diff
changeset
|
619 |
|
188 | 620 |
loadableBinaryObjectFormat |
621 |
"return a symbol describing the expected binary format |
|
622 |
for object files to be loadable. |
|
623 |
This is very machine specific." |
|
624 |
||
625 |
%{ /* NOCONTEXT */ |
|
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
626 |
|
188 | 627 |
#ifdef HAS_DL |
628 |
# if defined(SYSV4) || defined(ELF) |
|
629 |
RETURN ( @symbol(elf)); |
|
630 |
# endif |
|
1607
074a99bb9a50
alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents:
1602
diff
changeset
|
631 |
# if defined(__alpha__) && defined(__osf__) |
590 | 632 |
RETURN ( @symbol(coff)); |
633 |
# endif |
|
188 | 634 |
# if defined(GNU_DL) |
635 |
RETURN ( @symbol(aout)); |
|
636 |
# endif |
|
637 |
# if defined(AIX_DL) |
|
638 |
RETURN ( @symbol(xcoff)); |
|
639 |
# endif |
|
523 | 640 |
# if defined(HPUX10_DL) |
641 |
RETURN ( @symbol(hpcoff)); |
|
642 |
# endif |
|
188 | 643 |
# if defined(DL1_6) |
644 |
RETURN ( @symbol(coff)); |
|
645 |
# endif |
|
646 |
# if defined(WIN_DL) |
|
647 |
RETURN ( @symbol(dll)); |
|
648 |
# endif |
|
906 | 649 |
# if defined(BEOS_DL) |
650 |
RETURN ( @symbol(beobj)); |
|
651 |
# endif |
|
609 | 652 |
# if defined(__VMS__) |
653 |
RETURN ( @symbol(exe)); |
|
654 |
# endif |
|
3107 | 655 |
# if defined(__osx__) |
3054 | 656 |
RETURN ( @symbol(macho)); |
657 |
# endif |
|
188 | 658 |
#endif |
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
659 |
|
188 | 660 |
%}. |
661 |
^ nil |
|
662 |
||
663 |
" |
|
664 |
ObjectFileLoader loadableBinaryObjectFormat |
|
665 |
" |
|
666 |
! |
|
667 |
||
141 | 668 |
nm:file |
403 | 669 |
"this should return a string to list the namelist of file. |
670 |
The output of the command should be one line for each symbol, |
|
671 |
formatted as: |
|
2993 | 672 |
addr segment name |
403 | 673 |
This is parsed and read by #namesMatching:segment:in:. |
674 |
||
675 |
If your default nm command cannot produce this, write a little |
|
676 |
shell or awk script, to generate this and return a corresponding command |
|
521 | 677 |
below. |
678 |
This entry is obsolete (no longer req'd) and will vanish." |
|
141 | 679 |
|
680 |
|os| |
|
681 |
||
521 | 682 |
os := OperatingSystem getOSType. |
2935 | 683 |
(os = #irix or:[os = #osf]) ifTrue:[ |
2993 | 684 |
^ 'nm -B ' , file |
403 | 685 |
]. |
2935 | 686 |
(os = #solaris) ifTrue:[ |
2993 | 687 |
^ 'nm -p ' , file |
141 | 688 |
]. |
689 |
^ 'nm ' , file |
|
403 | 690 |
|
702
80f90a274837
more for alpha-dynamic loading
Claus Gittinger <cg@exept.de>
parents:
701
diff
changeset
|
691 |
"Modified: / 4.5.1998 / 12:18:47 / cg" |
141 | 692 |
! |
693 |
||
741 | 694 |
objectFileExtension |
695 |
"return the fileName extension used for objects, |
|
696 |
as generated by myself (output of cc). |
|
115 | 697 |
This is very machine specific." |
698 |
||
521 | 699 |
OperatingSystem isMSDOSlike ifTrue:[ |
741 | 700 |
"/ includes all of win32s, win95, winNT & os/2 |
701 |
^ '.obj' |
|
521 | 702 |
]. |
609 | 703 |
OperatingSystem isVMSlike ifTrue:[ |
741 | 704 |
^ '.obj' |
705 |
]. |
|
706 |
||
707 |
^ '.o' |
|
708 |
||
709 |
" |
|
710 |
ObjectFileLoader objectFileExtension |
|
711 |
" |
|
712 |
||
713 |
"Modified: / 4.5.1998 / 12:17:34 / cg" |
|
714 |
! |
|
715 |
||
716 |
sharedLibraryExtension |
|
717 |
"return the fileName extension used for dynamic loadable objects, |
|
718 |
as generated by myself (output of linker). |
|
719 |
This is very machine specific." |
|
720 |
||
1019 | 721 |
|suff| |
722 |
||
723 |
suff := self sharedLibrarySuffix. |
|
724 |
suff notNil ifTrue:[^ '.' , suff]. |
|
725 |
^ suff |
|
726 |
||
727 |
" |
|
728 |
ObjectFileLoader sharedLibraryExtension |
|
729 |
" |
|
730 |
||
731 |
"Modified: / 4.5.1998 / 12:17:34 / cg" |
|
732 |
! |
|
733 |
||
734 |
sharedLibrarySuffix |
|
735 |
"return the fileName suffix used for dynamic loadable objects, |
|
736 |
as generated by myself (output of linker). |
|
737 |
This is very machine specific." |
|
738 |
||
741 | 739 |
|os| |
740 |
||
741 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
3054 | 742 |
"/ includes all Windows systems & os/2 |
743 |
^ 'dll' |
|
741 | 744 |
]. |
745 |
OperatingSystem isVMSlike ifTrue:[ |
|
3054 | 746 |
^ 'exe' |
609 | 747 |
]. |
521 | 748 |
|
115 | 749 |
os := OperatingSystem getSystemType. |
3054 | 750 |
"/ are we really still supporting that old stuff? |
751 |
(self loadableBinaryObjectFormat == #aout) ifTrue:[ |
|
752 |
"/ not really shared, but loadable |
|
753 |
^ 'o' |
|
300
e351220115f5
added support to reload function object modules
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
754 |
]. |
2992 | 755 |
(os = #hpux) ifTrue:[ |
3054 | 756 |
^ 'sl' |
2992 | 757 |
]. |
119 | 758 |
|
1287
d1199118e73d
sharedLib loading (esp. freeBSD)
Claus Gittinger <cg@exept.de>
parents:
1254
diff
changeset
|
759 |
^ 'so' |
300
e351220115f5
added support to reload function object modules
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
760 |
|
741 | 761 |
" |
1019 | 762 |
ObjectFileLoader sharedLibrarySuffix |
741 | 763 |
" |
764 |
||
702
80f90a274837
more for alpha-dynamic loading
Claus Gittinger <cg@exept.de>
parents:
701
diff
changeset
|
765 |
"Modified: / 4.5.1998 / 12:17:34 / cg" |
115 | 766 |
! |
0 | 767 |
|
2012 | 768 |
useBorlandC |
769 |
^ ParserFlags useBorlandC |
|
770 |
||
771 |
"Created: / 15-03-2007 / 13:32:29 / cg" |
|
772 |
! |
|
773 |
||
134
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
774 |
validBinaryExtensions |
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
775 |
"return a collection of valid filename extension for binary files. |
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
776 |
This is very machine specific." |
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
777 |
|
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
778 |
|os| |
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
779 |
|
521 | 780 |
OperatingSystem isMSDOSlike ifTrue:[ |
3054 | 781 |
"/ includes all of win32s, win95, winNT & os/2 |
782 |
^ #('dll') |
|
521 | 783 |
]. |
609 | 784 |
OperatingSystem isVMSlike ifTrue:[ |
3054 | 785 |
^ #('exe') |
609 | 786 |
]. |
521 | 787 |
|
134
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
788 |
os := OperatingSystem getSystemType. |
2156
2cb69ec50829
#validBinaryExtensions - update for current OSes.
Stefan Vogel <sv@exept.de>
parents:
2154
diff
changeset
|
789 |
(os = 'linux') ifTrue:[ |
3054 | 790 |
"/ are we really still supporting that old stuff? |
791 |
self loadableBinaryObjectFormat == #aout ifTrue:[ |
|
792 |
^ #('o' 'obj' 'a') |
|
793 |
]. |
|
794 |
^ #('so') |
|
2156
2cb69ec50829
#validBinaryExtensions - update for current OSes.
Stefan Vogel <sv@exept.de>
parents:
2154
diff
changeset
|
795 |
]. |
2cb69ec50829
#validBinaryExtensions - update for current OSes.
Stefan Vogel <sv@exept.de>
parents:
2154
diff
changeset
|
796 |
(os = 'hpux') ifTrue:[^ #('sl') ]. |
784
c8742d9efcb6
suffix fix for systems with caseless filenames
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
797 |
(os = 'sunos') ifTrue:[^ #('o' 'obj' 'a') ]. |
c8742d9efcb6
suffix fix for systems with caseless filenames
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
798 |
(os = 'ultrix') ifTrue:[^ #('o' 'obj' 'ld' 'obj.ld') ]. |
2998 | 799 |
|
800 |
"/ a useful default |
|
134
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
801 |
|
1287
d1199118e73d
sharedLib loading (esp. freeBSD)
Claus Gittinger <cg@exept.de>
parents:
1254
diff
changeset
|
802 |
^ #('so') |
134
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
803 |
|
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
804 |
" |
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
805 |
ObjectFileLoader validBinaryExtensions |
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
806 |
" |
403 | 807 |
|
784
c8742d9efcb6
suffix fix for systems with caseless filenames
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
808 |
"Modified: / 1.10.1998 / 12:46:03 / cg" |
141 | 809 |
! ! |
810 |
||
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
811 |
!ObjectFileLoader class methodsFor:'dynamic object loading'! |
141 | 812 |
|
813 |
loadCPlusPlusObjectFile:aFileName |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
814 |
"load a c++ object file (.o-file) into the image. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
815 |
This method is not maintained (name mangling and static |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
816 |
initialization is so different among systems ...)" |
141 | 817 |
|
818 |
|handle initAddr list| |
|
819 |
||
820 |
handle := self loadDynamicObject:aFileName. |
|
821 |
handle isNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
822 |
^ nil |
141 | 823 |
]. |
824 |
||
609 | 825 |
list := self namesMatching:'__GLOBAL_$I*' segment:'[tT?]' in:aFileName. |
141 | 826 |
list size == 1 ifTrue:[ |
827 |
"/ (self isCPlusPlusObject:handle) ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
828 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
829 |
'a c++ object file' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
830 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
831 |
" |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
832 |
what I would like to get is the CTOR_LIST, |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
833 |
and call each function. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
834 |
But dld cannot (currently) handle SET-type symbols, therefore |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
835 |
we search (using nm) for all __GLOBAL_$I* syms, get their values |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
836 |
and call them each |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
837 |
" |
609 | 838 |
"/ list := self namesMatching:'__GLOBAL_$I*' segment:'[tT?]' in:aFileName. |
141 | 839 |
|
840 |
"/ initAddr := self getFunction:'__CTOR_LIST__' from:handle. |
|
841 |
"/ Verbose ifTrue:[ |
|
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
842 |
"/ ('calling CTORs at:' , (initAddr printStringRadix:16)) errorPrintCR |
141 | 843 |
"/ ]. |
844 |
||
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
845 |
initAddr := self getFunction:list first from:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
846 |
initAddr isNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
847 |
" |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
848 |
try with added underscore |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
849 |
" |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
850 |
initAddr := self getFunction:('_' , list first) from:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
851 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
852 |
(initAddr isNil and:[list first startsWith:'_']) ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
853 |
" |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
854 |
try with removed underscore |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
855 |
" |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
856 |
initAddr := self getFunction:(list first copyFrom:2) from:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
857 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
858 |
initAddr isNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
859 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
860 |
('no CTOR-func found (' , list first , ')') errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
861 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
862 |
self unloadDynamicObject:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
863 |
^ nil |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
864 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
865 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
866 |
('calling CTORs at:' , (initAddr printStringRadix:16)) errorPrintCR |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
867 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
868 |
self |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
869 |
saveCallInitFunctionAt:initAddr |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
870 |
in:aFileName |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
871 |
specialInit:false |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
872 |
forceOld:false |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
873 |
interruptable:false |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
874 |
argument:0 |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
875 |
identifyAs:nil |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
876 |
returnsObject:false. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
877 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
878 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
879 |
'done with CTORs.' errorPrintCR |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
880 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
881 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
882 |
" |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
883 |
cannot create a CPlusPlus class automatically (there could be more than |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
884 |
one classes in it too ...) |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
885 |
" |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
886 |
^ handle |
141 | 887 |
]. |
888 |
||
889 |
||
890 |
Verbose ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
891 |
'unknown object file' errorPrintCR |
141 | 892 |
]. |
2348
b2a3bb714bf6
comment/format in: #unloadObjectFile:
Stefan Vogel <sv@exept.de>
parents:
2346
diff
changeset
|
893 |
self unloadDynamicObject:handle. |
141 | 894 |
^ nil |
272 | 895 |
|
2459 | 896 |
"Modified: / 15-11-2010 / 13:19:06 / cg" |
141 | 897 |
! |
898 |
||
899 |
loadClass:aClassName fromObjectFile:aFileName |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
900 |
"load a compiled class (.o-file) into the image. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
901 |
Returns the class or nil." |
141 | 902 |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
903 |
|handle initAddr symName newClass moreHandles info status |
141 | 904 |
otherClass knownToBeOk| |
905 |
||
906 |
handle := self loadDynamicObject:aFileName. |
|
907 |
handle isNil ifTrue:[ |
|
3038 | 908 |
^ nil |
141 | 909 |
]. |
910 |
||
911 |
" |
|
912 |
get the Init-function; let the class install itself |
|
913 |
" |
|
914 |
symName := '_' , aClassName , '_Init'. |
|
915 |
initAddr := self getFunction:symName from:handle. |
|
916 |
initAddr isNil ifTrue:[ |
|
3038 | 917 |
"try with added underscore" |
918 |
symName := '__' , aClassName , '_Init'. |
|
919 |
initAddr := self getFunction:symName from:handle. |
|
141 | 920 |
]. |
921 |
||
922 |
knownToBeOk := true. |
|
923 |
||
924 |
"/ knownToBeOk ifFalse:[ |
|
468 | 925 |
"/ |list| |
365
22c85186e799
Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
346
diff
changeset
|
926 |
"/ |
141 | 927 |
"/ Verbose ifTrue:[ |
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
928 |
"/ 'looking for undefs ...' errorPrintCR. |
141 | 929 |
"/ ]. |
930 |
"/ |
|
931 |
"/ " |
|
932 |
"/ if there are any undefined symbols, we may have to load more |
|
933 |
"/ files (libs, other modules) |
|
934 |
"/ " |
|
935 |
"/ list := self getListOfUndefinedSymbolsFrom:handle. |
|
936 |
"/ list notNil ifTrue:[ |
|
937 |
"/ moreHandles := self loadModulesFromListOfUndefined:list. |
|
938 |
"/ |
|
939 |
"/ " |
|
940 |
"/ now, try again |
|
941 |
"/ " |
|
942 |
"/ symName := '_' , aClassName , '_Init'. |
|
943 |
"/ initAddr := self getFunction:symName from:handle. |
|
944 |
"/ initAddr isNil ifTrue:[ |
|
945 |
"/ "try with added underscore" |
|
946 |
"/ symName := '__' , aClassName , '_Init'. |
|
947 |
"/ initAddr := self getFunction:symName from:handle. |
|
948 |
"/ ]. |
|
949 |
"/ ] |
|
950 |
"/ ]. |
|
951 |
||
952 |
initAddr notNil ifTrue:[ |
|
3038 | 953 |
Verbose ifTrue:[ |
954 |
('calling init at: ' , (initAddr printStringRadix:16)) errorPrintCR. |
|
955 |
]. |
|
956 |
info := self performModuleInitAt:initAddr for:aClassName identifyAs:handle. |
|
957 |
status := info at:1. |
|
958 |
" |
|
959 |
if any classes are missing ... |
|
960 |
" |
|
961 |
(status == #missingClass) ifTrue:[ |
|
962 |
" |
|
963 |
... and we are loading a module ... |
|
964 |
" |
|
965 |
Transcript showCR:'try for missing class in same object ...'. |
|
966 |
Verbose ifTrue:[ |
|
967 |
'try for missing class:' errorPrint. (info at:2) errorPrintCR. |
|
968 |
]. |
|
969 |
otherClass := self loadClass:(info at:2) fromObjectFile:aFileName. |
|
970 |
otherClass notNil ifTrue:[ |
|
971 |
" |
|
972 |
try again ... |
|
973 |
" |
|
974 |
Transcript showCR:'missing class is here; try again ...'. |
|
975 |
info := self performModuleInitAt:initAddr for:aClassName identifyAs:handle. |
|
976 |
status := info at:1. |
|
977 |
] |
|
978 |
]. |
|
979 |
||
980 |
Verbose ifTrue:[ |
|
981 |
'done init status=' errorPrint. info errorPrintCR. |
|
982 |
]. |
|
983 |
(status == #unregisteredSuperclass) ifTrue:[ |
|
984 |
Transcript showCR:'superclass is not registered'. |
|
985 |
]. |
|
986 |
||
987 |
(Symbol hasInterned:aClassName) ifTrue:[ |
|
988 |
newClass := Smalltalk at:aClassName asSymbol ifAbsent:[nil]. |
|
989 |
Verbose ifTrue:[ |
|
990 |
'newClass is: ' errorPrint. newClass errorPrintCR |
|
991 |
]. |
|
992 |
newClass notNil ifTrue:[ |
|
993 |
Smalltalk at:aClassName asSymbol put:newClass. |
|
994 |
||
995 |
(newClass includesSelector:#initialize) ifTrue:[ |
|
996 |
Verbose ifTrue:[ |
|
997 |
'initialize newClass ...' errorPrintCR |
|
998 |
]. |
|
999 |
newClass initialize. |
|
1000 |
]. |
|
1001 |
"force cache flush" |
|
1002 |
Smalltalk isInitialized ifTrue:[ |
|
1003 |
Smalltalk changed. |
|
1004 |
] |
|
1005 |
]. |
|
1006 |
] ifFalse:[ |
|
1007 |
'ObjectFileLoader [warning]: class ' errorPrint. aClassName errorPrint. |
|
1008 |
' did not define itself' errorPrintCR |
|
1009 |
" |
|
1010 |
do not unload - could have installed other classes/methods ... |
|
1011 |
" |
|
1012 |
]. |
|
1013 |
^ newClass |
|
141 | 1014 |
]. |
1015 |
||
1016 |
Verbose ifTrue:[ |
|
3038 | 1017 |
('no symbol: ', symName,' in ',aFileName) errorPrintCR. |
141 | 1018 |
]. |
1019 |
||
1020 |
" |
|
1021 |
unload |
|
1022 |
" |
|
1023 |
Verbose ifTrue:[ |
|
3038 | 1024 |
'unloading due to init failure:' errorPrint. handle pathName errorPrintCR. |
141 | 1025 |
]. |
1026 |
||
3038 | 1027 |
"/ moreHandles notNil ifTrue:[ |
1028 |
"/ moreHandles do:[:eachHandle | |
|
1029 |
"/ Verbose ifTrue:[ |
|
1030 |
"/ ('unloading: ', eachHandle printString) errorPrintCR. |
|
1031 |
"/ ]. |
|
1032 |
"/ self unloadDynamicObject:eachHandle. |
|
1033 |
"/ ] |
|
1034 |
"/ ]. |
|
141 | 1035 |
|
1036 |
Verbose ifTrue:[ |
|
3038 | 1037 |
('unloading: ', handle printString) errorPrintCR. |
134
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
1038 |
]. |
141 | 1039 |
self unloadDynamicObject:handle. |
1040 |
^ nil |
|
1041 |
||
1042 |
" |
|
1043 |
ObjectFileLoader loadClass:'Tetris' fromObjectFile:'../clients/Tetris/Tetris.o' |
|
1044 |
ObjectFileLoader loadClass:'TetrisBlock' fromObjectFile:'../clients/Tetris/TBlock.o' |
|
1045 |
ObjectFileLoader loadClass:'Foo' fromObjectFile:'classList.o' |
|
1046 |
" |
|
272 | 1047 |
|
582
9a00e2dbdc97
must flush cached classes after loading (in case of private classes)
Claus Gittinger <cg@exept.de>
parents:
580
diff
changeset
|
1048 |
"Modified: 6.7.1997 / 12:34:48 / cg" |
141 | 1049 |
! |
1050 |
||
504 | 1051 |
loadLibrary:aLibraryFileName |
1052 |
"load a library; search in some standard places and using |
|
1053 |
standard suffixes (i.e. no suffix should be given in the arg). |
|
1054 |
Returns a handle or nil. |
|
1055 |
Use this to attach C-libraries." |
|
1056 |
||
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
1057 |
|s suffixes handle libFilename libPath| |
784
c8742d9efcb6
suffix fix for systems with caseless filenames
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1058 |
|
2746
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1059 |
Verbose ifTrue:[ |
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1060 |
('loadLibrary:' , aLibraryFileName) errorPrintCR. |
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1061 |
]. |
784
c8742d9efcb6
suffix fix for systems with caseless filenames
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1062 |
libFilename := aLibraryFileName asFilename. |
c8742d9efcb6
suffix fix for systems with caseless filenames
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
1063 |
(s := libFilename suffix) isEmpty ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1064 |
suffixes := self validBinaryExtensions |
504 | 1065 |
] ifFalse:[ |
2746
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1066 |
suffixes := Array with:s |
504 | 1067 |
]. |
1068 |
||
1069 |
"/ try each suffix ... |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
1070 |
suffixes do:[:aSuffix | |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1071 |
|fn f| |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1072 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1073 |
aSuffix isEmptyOrNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1074 |
fn := libFilename. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1075 |
] ifFalse:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1076 |
fn := libFilename withSuffix:aSuffix. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1077 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1078 |
|
2746
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1079 |
Verbose ifTrue:[ |
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1080 |
('loadLibrary try:' , fn asString) errorPrintCR. |
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1081 |
]. |
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1082 |
|
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1083 |
handle := self loadObjectFile:fn asString. |
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1084 |
handle notNil ifTrue:[^ handle]. |
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1085 |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1086 |
(libFilename isAbsolute |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1087 |
or:[(aLibraryFileName startsWith:'./') |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1088 |
or:[(aLibraryFileName startsWith:'../')]]) ifTrue:[ |
2746
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1089 |
"/ already tried... |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1090 |
] ifFalse:[ |
2746
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1091 |
"/ try to load it by name - maybe someone else knows |
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1092 |
"/ how to find it (the system itself) |
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1093 |
|
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
1094 |
"/ try each directory in libPath |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1095 |
libPath := self libPath. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1096 |
libPath notEmptyOrNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1097 |
(libPath asCollectionOfSubstringsSeparatedBy:$:) do:[:eachSinglePath | |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1098 |
f := eachSinglePath asFilename construct:fn. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1099 |
f exists ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1100 |
handle := self loadObjectFile:f pathName. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1101 |
handle notNil ifTrue:[^ handle]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1102 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1103 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1104 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1105 |
] |
504 | 1106 |
]. |
1107 |
||
1108 |
^ nil |
|
1109 |
||
1110 |
" |
|
1111 |
ObjectFileLoader loadLibrary:'libjpeg' |
|
845 | 1112 |
ObjectFileLoader loadLibrary:'odbc32' |
504 | 1113 |
" |
1114 |
||
845 | 1115 |
"Modified: / 4.5.1999 / 17:01:47 / cg" |
504 | 1116 |
! |
1117 |
||
174 | 1118 |
loadMethodObjectFile:aFileName |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
1119 |
"load an object file (.o-file) for a single method into the image; |
174 | 1120 |
This does a slightly different initialization. |
1121 |
Return an object handle; nil on error" |
|
1122 |
||
346 | 1123 |
|handle initAddr initName m| |
174 | 1124 |
|
300
e351220115f5
added support to reload function object modules
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
1125 |
"/ |
e351220115f5
added support to reload function object modules
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
1126 |
"/ load the objectfile |
e351220115f5
added support to reload function object modules
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
1127 |
"/ |
174 | 1128 |
handle := self loadDynamicObject:aFileName. |
1129 |
handle isNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1130 |
^ nil |
174 | 1131 |
]. |
1132 |
||
300
e351220115f5
added support to reload function object modules
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
1133 |
"/ |
e351220115f5
added support to reload function object modules
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
1134 |
"/ find the entry function |
e351220115f5
added support to reload function object modules
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
1135 |
"/ |
e351220115f5
added support to reload function object modules
Claus Gittinger <cg@exept.de>
parents:
291
diff
changeset
|
1136 |
initName := aFileName asFilename withoutSuffix baseName. |
174 | 1137 |
|
1138 |
initAddr := self getFunction:'__' , initName , '_Init' from:handle. |
|
1139 |
initAddr isNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1140 |
initAddr := ObjectFileLoader getFunction:'_' , initName , '_Init' from:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1141 |
initAddr isNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1142 |
(self getListOfUndefinedSymbolsFrom:handle) size > 0 ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1143 |
self listUndefinedSymbolsIn:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1144 |
'ObjectFileLoader [info]: undefined symbols in primitive code' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1145 |
] ifFalse:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1146 |
('ObjectFileLoader [info]: ' , initName , '_Init() lookup failed') errorPrintCR |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1147 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1148 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1149 |
"/ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1150 |
"/ not found - unload |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1151 |
"/ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1152 |
self unloadDynamicObject:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1153 |
^ nil |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1154 |
] |
174 | 1155 |
]. |
1156 |
||
1555 | 1157 |
OSSignalInterrupt handle:[:ex | |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1158 |
('ObjectFileLoader [warning]: hard error in initFunction: ' , initName , ' of method-module ' , aFileName) errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1159 |
self unloadDynamicObject:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1160 |
^ nil |
790 | 1161 |
] do:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1162 |
"/ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1163 |
"/ call it - it returns the new method object |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1164 |
"/ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1165 |
self "/ registration |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1166 |
saveCallInitFunctionAt:initAddr |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1167 |
in:aFileName |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1168 |
specialInit:true |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1169 |
forceOld:true |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1170 |
interruptable:false |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1171 |
argument:0 |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1172 |
identifyAs:handle |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1173 |
returnsObject:false. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1174 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1175 |
self |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1176 |
saveCallInitFunctionAt:initAddr "/ global setup |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1177 |
in:aFileName |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1178 |
specialInit:true |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1179 |
forceOld:true |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1180 |
interruptable:false |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1181 |
argument:1 |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1182 |
identifyAs:handle |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1183 |
returnsObject:false. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1184 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1185 |
m := self |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1186 |
saveCallInitFunctionAt:initAddr "/ initialization |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1187 |
in:aFileName |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1188 |
specialInit:true |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1189 |
forceOld:true |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1190 |
interruptable:false |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1191 |
argument:2 |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1192 |
identifyAs:handle |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1193 |
returnsObject:true. |
790 | 1194 |
]. |
174 | 1195 |
|
1196 |
handle method:m. |
|
1197 |
^ handle |
|
1198 |
||
1942
dffae6fd22d8
oops - initialization of single-method objects needs phase1
Claus Gittinger <cg@exept.de>
parents:
1906
diff
changeset
|
1199 |
"Created: / 05-12-1995 / 20:59:46 / cg" |
2459 | 1200 |
"Modified: / 15-11-2010 / 13:20:36 / cg" |
174 | 1201 |
! |
1202 |
||
141 | 1203 |
loadObjectFile:aFileName |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
1204 |
"load an object file (.o-file) into the image; |
141 | 1205 |
the class name is not needed (multiple definitions may be in the file). |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
1206 |
This may be either a smalltalk object or a C-object file. |
472 | 1207 |
The object files init function (if any) is called, and the module |
1208 |
is unloaded if it returns failure (use lowLevel load, to load a file |
|
1209 |
without automatic initialization). |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
1210 |
Return nil on error, an objectFile handle if ok." |
141 | 1211 |
|
916
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
1212 |
^ self |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
1213 |
loadObjectFile:aFileName |
1010 | 1214 |
invokeInitializeMethods:true |
916
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
1215 |
! |
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
1216 |
|
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
1217 |
loadObjectFile:pathNameOrFilename invokeInitializeMethods:invokeInitializeMethods |
1993
b83da4907a07
more info when library cannot be loaded
Stefan Vogel <sv@exept.de>
parents:
1988
diff
changeset
|
1218 |
"load an object file (.dll or .so-file) into the image; |
916
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
1219 |
the class name is not needed (multiple definitions may be in the file). |
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
1220 |
This may be either a smalltalk object or a C-object file. |
3006 | 1221 |
The object file's init function (if any) is called, and the module |
916
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
1222 |
is unloaded if it returns failure (use lowLevel load, to load a file |
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
1223 |
without automatic initialization). |
3006 | 1224 |
Returns nil on error, or the objectFile's handle if ok." |
1225 |
||
1226 |
|filename pathName handle initAddr initDefinitionAddr initFunctionName initNames didInit info status |
|
3007 | 1227 |
dummyHandle msg isCModule doNotUnload definitionClassName definitionClass| |
141 | 1228 |
|
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
1229 |
filename := pathNameOrFilename asFilename. |
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
1230 |
pathName := filename pathName. |
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
1231 |
|
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
1232 |
handle := self handleForDynamicObject:filename. |
1988
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
1233 |
handle notNil ifTrue:[ |
3006 | 1234 |
"already loaded" |
1235 |
^ handle. |
|
1988
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
1236 |
]. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
1237 |
|
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
1238 |
handle := self loadDynamicObject:filename. |
141 | 1239 |
handle isNil ifTrue:[ |
3006 | 1240 |
^ nil |
141 | 1241 |
]. |
1242 |
||
1243 |
didInit := false. |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
1244 |
isCModule := false. |
141 | 1245 |
|
1993
b83da4907a07
more info when library cannot be loaded
Stefan Vogel <sv@exept.de>
parents:
1988
diff
changeset
|
1246 |
"with dld, load may have worked, even if undefined symbols |
b83da4907a07
more info when library cannot be loaded
Stefan Vogel <sv@exept.de>
parents:
1988
diff
changeset
|
1247 |
are to be resolved. If that's the case, load all libraries ..." |
141 | 1248 |
|
1659 | 1249 |
ParserFlags searchedLibraries notNil ifTrue:[ |
3006 | 1250 |
(self hasUndefinedSymbolsIn:handle) ifTrue:[ |
1251 |
self initializeLoader. |
|
1252 |
||
1253 |
ParserFlags searchedLibraries do:[:libName | |
|
1254 |
(self hasUndefinedSymbolsIn:handle) ifTrue:[ |
|
1255 |
Transcript showCR:' ... trying ' , libName , ' to resolve undefined symbols ...'. |
|
1256 |
dummyHandle := Array new:4. |
|
1257 |
dummyHandle := self primLoadDynamicObject:libName into:dummyHandle. |
|
228
be9939d96cfe
removed a wrong debug message
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
1258 |
"/ dummyHandle isNil ifTrue:[ |
272 | 1259 |
"/ Transcript showCR:' ... load of library ' , libName , ' failed.'. |
228
be9939d96cfe
removed a wrong debug message
Claus Gittinger <cg@exept.de>
parents:
227
diff
changeset
|
1260 |
"/ ] |
3006 | 1261 |
] |
1262 |
]. |
|
1263 |
(self hasUndefinedSymbolsIn:handle) isNil ifTrue:[ |
|
1264 |
Transcript showCR:('ObjectFileLoader [info]: still undefined symbols in ', pathName,'.'). |
|
1265 |
]. |
|
1266 |
] |
|
141 | 1267 |
]. |
2882
e7fb69ba1a54
Fix #loadObjectFile:invokeInitializeMethods: for snapshot reload
Stefan Vogel <sv@exept.de>
parents:
2806
diff
changeset
|
1268 |
|
141 | 1269 |
" |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1270 |
first, expect the classes-name to be the fileNames-baseName |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1271 |
(if its not, it may be a method or function module; |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1272 |
in this case, the Init function is supposed to use that naming |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1273 |
scheme as well) |
141 | 1274 |
" |
3006 | 1275 |
initFunctionName := self initFunctionBasenameForFile:filename. |
1276 |
||
1277 |
"look for explicit initDefinition (xxx_InitDefinition) function |
|
1278 |
This is used in ST packaged classLib object files" |
|
1279 |
||
3029 | 1280 |
(initFunctionName startsWith:'lib') ifTrue:[ |
1281 |
definitionClassName := initFunctionName copyFrom:4. |
|
1282 |
definitionClass := Smalltalk classNamed:definitionClassName. |
|
1283 |
]. |
|
3030 | 1284 |
(definitionClass isNil or:[definitionClass isLoaded not]) ifTrue:[ |
3029 | 1285 |
"the project definition class has not been loaded yet. |
1286 |
initialize and load it" |
|
1287 |
||
1288 |
initDefinitionAddr := self findInitDefinitionFunction:initFunctionName in:handle. |
|
3032 | 1289 |
initDefinitionAddr isNil ifTrue:[ |
1290 |
('WARNING: no init definitions for: ' , pathName) errorPrintCR. |
|
1291 |
] ifFalse:[ |
|
3029 | 1292 |
Verbose ifTrue:[ |
1293 |
('calling initDefinition at:' , (initDefinitionAddr printStringRadix:16)) errorPrintCR. |
|
1294 |
]. |
|
1295 |
info := self |
|
1296 |
performModuleInitAt:initDefinitionAddr |
|
1297 |
invokeInitializeMethods:false |
|
3030 | 1298 |
for:definitionClassName |
3029 | 1299 |
identifyAs:handle. |
1300 |
status := info at:1. |
|
1301 |
status == #ok ifTrue:[ |
|
1302 |
"/ now, we have only loaded and installed the projectDefinition class. |
|
1303 |
"/ (but no containing classes or extensions, yet). |
|
1304 |
"/ let the projectDefinition load any prereqs |
|
1305 |
definitionClassName notNil ifTrue:[ |
|
3030 | 1306 |
definitionClass := Smalltalk classNamed:definitionClassName. |
1307 |
definitionClass notNil ifTrue:[ |
|
1308 |
definitionClass |
|
1309 |
initialize; |
|
3036 | 1310 |
loadPreRequisitesAsAutoloaded:false. |
3029 | 1311 |
]. |
1312 |
]. |
|
1313 |
] |
|
3006 | 1314 |
]. |
1315 |
]. |
|
1993
b83da4907a07
more info when library cannot be loaded
Stefan Vogel <sv@exept.de>
parents:
1988
diff
changeset
|
1316 |
"look for explicit init (xxx_Init) function |
b83da4907a07
more info when library cannot be loaded
Stefan Vogel <sv@exept.de>
parents:
1988
diff
changeset
|
1317 |
This is used in ST object files" |
b83da4907a07
more info when library cannot be loaded
Stefan Vogel <sv@exept.de>
parents:
1988
diff
changeset
|
1318 |
|
3006 | 1319 |
initAddr := self findInitFunction:initFunctionName in:handle. |
141 | 1320 |
initAddr notNil ifTrue:[ |
3006 | 1321 |
Verbose ifTrue:[ |
1322 |
('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR. |
|
1323 |
]. |
|
1324 |
info := self |
|
1325 |
performModuleInitAt:initAddr |
|
1326 |
invokeInitializeMethods:invokeInitializeMethods |
|
1327 |
for:nil |
|
1328 |
identifyAs:handle. |
|
1329 |
status := info at:1. |
|
1330 |
status == #ok ifTrue:[ |
|
1331 |
didInit := true. |
|
3036 | 1332 |
definitionClassName notNil ifTrue:[ |
1333 |
definitionClass := Smalltalk classNamed:definitionClassName. |
|
1334 |
] |
|
3006 | 1335 |
] |
141 | 1336 |
] ifFalse:[ |
3006 | 1337 |
"look for explicit C-init (xxx__Init) function |
1338 |
This is used in C object files" |
|
1339 |
||
1340 |
initAddr := self findFunction:initFunctionName suffix:'__Init' in:handle. |
|
1341 |
initAddr notNil ifTrue:[ |
|
1342 |
isCModule := true. |
|
1343 |
||
1344 |
OSSignalInterrupt handle:[:ex | |
|
1345 |
('ObjectFileLoader [warning]: hard error in initFunction of class-module: ' , pathName) errorPrintCR. |
|
1346 |
status := #initFailed. |
|
1347 |
] do:[ |
|
1348 |
(self |
|
1349 |
saveCallInitFunctionAt:initAddr |
|
1350 |
in:pathNameOrFilename |
|
1351 |
specialInit:false |
|
1352 |
forceOld:true |
|
1353 |
interruptable:false |
|
1354 |
argument:0 |
|
1355 |
identifyAs:handle |
|
1356 |
returnsObject:false) < 0 |
|
1357 |
ifTrue:[ |
|
1358 |
Verbose ifTrue:[ |
|
1359 |
'init function return failure ... unload' errorPrintCR. |
|
1360 |
]. |
|
1361 |
status := #initFailed. |
|
1362 |
] ifFalse:[ |
|
1363 |
didInit := true. |
|
1364 |
] |
|
1365 |
] |
|
1366 |
] ifFalse:[ |
|
1367 |
status := #noInitFunction. |
|
1368 |
||
1369 |
"look for any init-function(s); call them all" |
|
1370 |
Verbose ifTrue:[ |
|
1371 |
'no good init functions found; looking for candidates ...' errorPrintCR. |
|
1372 |
]. |
|
1373 |
initNames := self namesMatching:'*_Init' segment:'[tT?]' in:pathName. |
|
1374 |
initNames notNil ifTrue:[ |
|
1375 |
initNames do:[:aName | |
|
1376 |
initAddr := self getFunction:aName from:handle. |
|
1377 |
initAddr isNil ifTrue:[ |
|
1378 |
(aName startsWith:'_') ifTrue:[ |
|
1379 |
initAddr := self getFunction:(aName copyFrom:2) from:handle. |
|
1380 |
]. |
|
1381 |
]. |
|
1382 |
initAddr isNil ifTrue:[ |
|
1383 |
Transcript showCR:('no symbol: ',aName,' in ', pathName). |
|
1384 |
] ifFalse:[ |
|
1385 |
Verbose ifTrue:[ |
|
1386 |
('calling init at:' , (initAddr printStringRadix:16)) errorPrintCR |
|
1387 |
]. |
|
1388 |
self |
|
1389 |
performModuleInitAt:initAddr |
|
1390 |
invokeInitializeMethods:invokeInitializeMethods |
|
1391 |
for:nil |
|
1392 |
identifyAs:handle. |
|
1393 |
didInit := true. |
|
1394 |
] |
|
1395 |
]. |
|
1396 |
]. |
|
1397 |
] |
|
141 | 1398 |
]. |
1399 |
||
2457
1927f463ca87
changed: #loadObjectFile:invokeInitializeMethods:
Claus Gittinger <cg@exept.de>
parents:
2456
diff
changeset
|
1400 |
(invokeInitializeMethods and:[didInit not]) ifTrue:[ |
3006 | 1401 |
status == #noInitFunction ifTrue:[ |
3035 | 1402 |
msg := 'no classLib init function found; assume load ok' |
3006 | 1403 |
] ifFalse:[ |
1404 |
(status ~~ #registrationFailed |
|
1405 |
and:[status ~~ #initFailed |
|
1406 |
and:[status ~~ #missingClass |
|
1407 |
and:[status ~~ #versionMismatch]]]) |
|
1408 |
ifTrue:[ |
|
1409 |
self listUndefinedSymbolsIn:handle. |
|
1410 |
]. |
|
1411 |
||
1412 |
Verbose ifTrue:[ |
|
1413 |
'unloading, since init failed ...' errorPrintCR. |
|
1414 |
]. |
|
1415 |
||
1416 |
"/ give caller a chance to prevent unloading (to register later, when a prerequisite class comes) |
|
1417 |
status == #missingClass ifTrue:[ |
|
1418 |
self breakPoint:#sv. |
|
1419 |
doNotUnload := (SuperClassMissingErrorNotification query ? false). |
|
1420 |
] ifFalse:[ |
|
1421 |
status == #registrationFailed ifTrue:[ |
|
1422 |
self breakPoint:#sv. |
|
1423 |
doNotUnload := (RegistrationFailedErrorNotification query ? false). |
|
1424 |
] ifFalse:[ |
|
1425 |
doNotUnload := false. |
|
1426 |
]. |
|
1427 |
]. |
|
1428 |
doNotUnload ifFalse:[ |
|
1429 |
self unloadDynamicObject:handle. |
|
1430 |
Verbose ifTrue:[ |
|
1431 |
'unloaded.' errorPrintCR. |
|
1432 |
]. |
|
1433 |
handle := nil. |
|
1434 |
]. |
|
1435 |
||
1436 |
status == #initFailed ifTrue:[ |
|
1437 |
msg := 'module not loaded (init function signaled failure).' |
|
1438 |
] ifFalse:[ |
|
1439 |
status == #missingClass ifTrue:[ |
|
1440 |
msg := 'module not loaded (superclass missing: ' , (info at:2) , ').' |
|
1441 |
] ifFalse:[ |
|
1442 |
status == #registrationFailed ifTrue:[ |
|
1443 |
msg := 'module registration failed (incompatible object or missing superclass)' |
|
1444 |
] ifFalse:[ |
|
1445 |
status == #versionMismatch ifTrue:[ |
|
1446 |
msg := 'module registration failed (class version mismatch ' , (info at:2) printString , ')' |
|
1447 |
] ifFalse:[ |
|
1448 |
(self namesMatching:'*__sepInitCode__*' segment:'[tT?]' in:pathName) notNil ifTrue:[ |
|
1449 |
msg := 'module not loaded (unknown error reason).' |
|
1450 |
] ifFalse:[ |
|
1451 |
msg := 'module not loaded (no _Init entry in object file ?).' |
|
1452 |
] |
|
1453 |
] |
|
1454 |
]. |
|
1455 |
]. |
|
1456 |
]. |
|
1457 |
]. |
|
1458 |
msg := 'ObjectFileLoader [info]: <1p>: <2p>' expandMacrosWith:pathNameOrFilename asFilename baseName with:msg. |
|
1459 |
Smalltalk isStandAloneApp ifTrue:[ |
|
1460 |
msg errorPrintCR |
|
1461 |
] ifFalse:[ |
|
1462 |
Transcript showCR:msg |
|
1463 |
]. |
|
141 | 1464 |
]. |
1465 |
||
471
508fa84cb122
no init function: assume load ok.
Claus Gittinger <cg@exept.de>
parents:
470
diff
changeset
|
1466 |
isCModule ifFalse:[ |
3006 | 1467 |
Smalltalk flushCachedClasses. |
1468 |
Class flushSubclassInfo. |
|
3037 | 1469 |
|
3032 | 1470 |
(definitionClass notNil and:[definitionClass isLoaded]) ifTrue:[ |
3034 | 1471 |
definitionClass loadAllClassesAsAutoloaded:true. |
3031 | 1472 |
definitionClass projectIsLoaded:true. |
1473 |
]. |
|
3006 | 1474 |
Smalltalk isInitialized ifTrue:[ |
1475 |
"really don't know, if and what has changed ... |
|
1476 |
... but assume, that new classes have been installed." |
|
1477 |
Smalltalk changed. |
|
1478 |
]. |
|
157
d7f68808a258
reload objects in the previous order
Claus Gittinger <cg@exept.de>
parents:
156
diff
changeset
|
1479 |
]. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
1480 |
^ handle |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
1481 |
|
2459 | 1482 |
"Modified: / 15-11-2010 / 13:19:26 / cg" |
141 | 1483 |
! |
1484 |
||
1485 |
unloadAllObsoleteObjectFiles |
|
1486 |
"unload all dynamically loaded object files for which the classes/method |
|
1487 |
has been already garbage collected." |
|
1488 |
||
1489 |
LoadedObjects notNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1490 |
LoadedObjects values copy do:[:eachHandle | |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1491 |
(eachHandle notNil and:[eachHandle isObsolete]) ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1492 |
self unloadDynamicObject:eachHandle |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1493 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1494 |
] |
141 | 1495 |
]. |
1496 |
||
1497 |
" |
|
1498 |
ObjectFileLoader unloadAllObsoleteObjectFiles |
|
134
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
1499 |
" |
151
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
149
diff
changeset
|
1500 |
|
7f46f760ba45
automatically unload modules for garbage collected methods/classes
Claus Gittinger <cg@exept.de>
parents:
149
diff
changeset
|
1501 |
"Modified: 5.12.1995 / 18:16:52 / cg" |
134
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
1502 |
! |
d93682ca90a1
more queries for valid objectfilenames
Claus Gittinger <cg@exept.de>
parents:
130
diff
changeset
|
1503 |
|
141 | 1504 |
unloadObjectFile:aFileName |
1505 |
"unload an object file (.o-file) from the image. |
|
1506 |
DANGER ALERT: currently, you have to make sure that no references to |
|
1507 |
objects of this module exist - in future versions, the system will keep |
|
1508 |
track of these. For now, use at your own risk. |
|
1509 |
(especially critical are blocks-functions)." |
|
1510 |
||
1511 |
|handle| |
|
1512 |
||
1513 |
LoadedObjects notNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1514 |
handle := LoadedObjects at:aFileName ifAbsent:nil |
141 | 1515 |
]. |
1516 |
handle isNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1517 |
('ObjectFileLoader [info]: oops - file to be unloaded was not loaded dynamically (', aFileName , ')') infoPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1518 |
^ self |
141 | 1519 |
]. |
1520 |
||
2348
b2a3bb714bf6
comment/format in: #unloadObjectFile:
Stefan Vogel <sv@exept.de>
parents:
2346
diff
changeset
|
1521 |
"/ call the modules deInit-function and unload... |
141 | 1522 |
self unloadDynamicObject:handle |
1961 | 1523 |
|
1524 |
"Modified: / 06-12-2006 / 18:19:13 / cg" |
|
634 | 1525 |
! |
1526 |
||
1527 |
unloadObjectFileAndRemoveClasses:aFileName |
|
1528 |
"unload an object file (.o-file) from the image and remove all |
|
1529 |
corresponding classes from the system. |
|
1530 |
DANGER ALERT: currently, you have to make sure that no references to |
|
1531 |
objects of this module exist - in future versions, the system will keep |
|
1532 |
track of these. For now, use at your own risk. |
|
1533 |
(especially critical are blocks-functions)." |
|
1534 |
||
1535 |
|handle| |
|
1536 |
||
1537 |
LoadedObjects notNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1538 |
handle := LoadedObjects at:aFileName ifAbsent:nil |
634 | 1539 |
]. |
1540 |
handle isNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1541 |
('ObjectFileLoader [info]: oops - file to be unloaded was not loaded dynamically (', (aFileName ? 'unknown-file') , ')') infoPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1542 |
^ self |
634 | 1543 |
]. |
1544 |
handle isClassLibHandle ifFalse:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1545 |
self error:'Module is not a classLib module. Proceed to unload anyway' mayProceed:true. |
634 | 1546 |
]. |
1547 |
||
1548 |
"/ remove the classes ... |
|
1549 |
Class withoutUpdatingChangesDo:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1550 |
handle classes do:[:eachClass | |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1551 |
(eachClass notNil and:[eachClass isMeta not]) ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1552 |
eachClass removeFromSystem. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1553 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
1554 |
] |
634 | 1555 |
]. |
1556 |
||
2348
b2a3bb714bf6
comment/format in: #unloadObjectFile:
Stefan Vogel <sv@exept.de>
parents:
2346
diff
changeset
|
1557 |
"/ call the modules deInit-function and unload... |
634 | 1558 |
self unloadDynamicObject:handle |
1559 |
||
1961 | 1560 |
"Modified: / 06-12-2006 / 18:19:19 / cg" |
141 | 1561 |
! ! |
1562 |
||
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
1563 |
!ObjectFileLoader class methodsFor:'dynamic object queries'! |
141 | 1564 |
|
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1565 |
findFunction:functionName suffix:suffix in:handle |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1566 |
"look for the init function and returns its address" |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1567 |
|
609 | 1568 |
|initAddr className nm| |
1569 |
||
1570 |
"/ care for colons, as found in nameSpace classes ... |
|
747 | 1571 |
nm := functionName asString copyReplaceAll:$: with:$_. |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1572 |
|
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1573 |
" |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1574 |
look for explicit init function |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1575 |
" |
609 | 1576 |
initAddr := self getFunction:(nm , suffix) from:handle. |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1577 |
initAddr notNil ifTrue:[^ initAddr]. |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1578 |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
1579 |
initAddr := self getFunction:('_' , nm , suffix) from:handle. |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1580 |
initAddr notNil ifTrue:[^ initAddr]. |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1581 |
|
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1582 |
"/ |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
1583 |
"/ special for broken ultrix nlist |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1584 |
"/ (will not find symbol with single underscore) |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1585 |
"/ workaround: add another underscore and retry |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1586 |
"/ |
609 | 1587 |
initAddr := self getFunction:('__' , nm , suffix) from:handle. |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1588 |
initAddr notNil ifTrue:[^ initAddr]. |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1589 |
|
2784
6e2515a22a6c
changed: #findFunction:suffix:in:
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
1590 |
(functionName startsWith:'lib') ifTrue:[ |
2919 | 1591 |
className := functionName |
2784
6e2515a22a6c
changed: #findFunction:suffix:in:
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
1592 |
] ifFalse:[ |
2919 | 1593 |
" |
1594 |
look for reverse abbreviation - slow, because abbrevs are recursively read |
|
1595 |
" |
|
1596 |
className := Smalltalk classNameForFile:functionName. |
|
2784
6e2515a22a6c
changed: #findFunction:suffix:in:
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
1597 |
]. |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1598 |
className notNil ifTrue:[ |
2919 | 1599 |
initAddr := self getFunction:(className , suffix) from:handle. |
1600 |
initAddr notNil ifTrue:[^ initAddr]. |
|
1601 |
||
1602 |
initAddr := self getFunction:('_' , className , suffix) from:handle. |
|
1603 |
initAddr isNil ifTrue:[ |
|
1604 |
"/ |
|
1605 |
"/ special for broken ultrix nlist |
|
1606 |
"/ (will not find symbol with single underscore) |
|
1607 |
"/ workaround: add another underscore and retry |
|
1608 |
"/ |
|
1609 |
initAddr := self getFunction:('__' , className , suffix) from:handle. |
|
1610 |
]. |
|
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1611 |
]. |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1612 |
^ initAddr |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1613 |
|
2784
6e2515a22a6c
changed: #findFunction:suffix:in:
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
1614 |
"Created: / 13-07-1996 / 00:38:01 / cg" |
6e2515a22a6c
changed: #findFunction:suffix:in:
Claus Gittinger <cg@exept.de>
parents:
2767
diff
changeset
|
1615 |
"Modified: / 16-01-2012 / 19:57:11 / cg" |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1616 |
! |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1617 |
|
3006 | 1618 |
findInitDefinitionFunction:functionName in:handle |
1619 |
"look for the initDefinition function and return its address or nil" |
|
1620 |
||
1621 |
^ self findFunction:functionName suffix:'_InitDefinition' in:handle |
|
1622 |
||
1623 |
"Modified: 13.7.1996 / 00:38:33 / cg" |
|
1624 |
! |
|
1625 |
||
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1626 |
findInitFunction:functionName in:handle |
3006 | 1627 |
"look for the init function and return its address or nil" |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1628 |
|
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1629 |
^ self findFunction:functionName suffix:'_Init' in:handle |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1630 |
|
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1631 |
"Modified: 13.7.1996 / 00:38:33 / cg" |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1632 |
! |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
1633 |
|
1745 | 1634 |
getFunction:aStringOrSymbol from:handle |
141 | 1635 |
"return the address of a function from a dynamically loaded object file. |
1636 |
Handle must be the one returned previously from loadDynamicObject. |
|
1637 |
Return the address of the function, or nil on any error." |
|
1638 |
||
1745 | 1639 |
^ self getSymbol:aStringOrSymbol asString function:true from:handle |
141 | 1640 |
! |
1641 |
||
1642 |
getListOfUndefinedSymbolsFrom:aHandle |
|
1643 |
"return a collection of undefined symbols in a dynamically loaded object file. |
|
1644 |
Handle must be the one returned previously from loadDynamicObject. |
|
1645 |
Not all systems allow an object with undefined symbols to be |
|
1646 |
loaded (actually, only dld does)." |
|
1647 |
||
1648 |
|list| |
|
1649 |
||
1650 |
%{ /* STACK: 20000 */ |
|
1651 |
#ifdef GNU_DL |
|
1652 |
void (*func)(); |
|
1653 |
unsigned long addr; |
|
1654 |
char *name; |
|
1655 |
int nMax; |
|
1656 |
char **undefNames; |
|
1657 |
||
1658 |
undefNames = dld_list_undefined_sym(); |
|
1659 |
if (dld_undefined_sym_count > 0) { |
|
1660 |
char **nm; |
|
1661 |
int index; |
|
1662 |
int count = dld_undefined_sym_count; |
|
1663 |
||
1664 |
if (count > 100) count = 100; |
|
1665 |
list = __ARRAY_NEW_INT(count); |
|
1666 |
if (list) { |
|
1667 |
nm = undefNames; |
|
1668 |
for (index = 0; index < count; index++) { |
|
1669 |
OBJ s; |
|
1670 |
||
238 | 1671 |
s = __MKSTRING(*nm); |
1672 |
__ArrayInstPtr(list)->a_element[index] = s; |
|
141 | 1673 |
__STORE(list, s); |
1674 |
nm++; |
|
1675 |
} |
|
1676 |
free(undefNames); |
|
1677 |
} |
|
1678 |
} |
|
1679 |
#endif |
|
1680 |
||
1681 |
#ifdef DL1_6 |
|
1682 |
/* |
|
2998 | 1683 |
* don't know how to do it |
141 | 1684 |
*/ |
1685 |
#endif |
|
1686 |
||
1687 |
#ifdef SYSV4_DL |
|
1688 |
/* |
|
2998 | 1689 |
* don't know how to do it |
141 | 1690 |
*/ |
1691 |
#endif |
|
1692 |
||
1693 |
#ifdef SUN_DL |
|
1694 |
/* |
|
2998 | 1695 |
* don't know how to do it |
141 | 1696 |
*/ |
1697 |
#endif |
|
1698 |
||
1699 |
#ifdef NEXT_DL |
|
1700 |
/* |
|
2998 | 1701 |
* don't know how to do it |
141 | 1702 |
*/ |
1703 |
#endif |
|
180 | 1704 |
|
1705 |
#ifdef WIN_DL |
|
1706 |
/* |
|
2998 | 1707 |
* don't know how to do it |
180 | 1708 |
*/ |
1709 |
#endif |
|
1710 |
||
906 | 1711 |
#ifdef BEOS_DL |
1712 |
/* |
|
2998 | 1713 |
* don't know how to do it |
906 | 1714 |
*/ |
1715 |
#endif |
|
1716 |
||
141 | 1717 |
%}. |
1718 |
^ list |
|
1719 |
! |
|
1720 |
||
1721 |
getSymbol:aString function:isFunction from:aHandle |
|
1722 |
"return the address of a symbol/function from a dynamically loaded object file. |
|
1723 |
Handle must be the one returned previously from loadDynamicObject. |
|
1724 |
Return the address of the symbol, or nil on any error." |
|
1725 |
||
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1726 |
|sysHandle1 sysHandle2 pathName address| |
141 | 1727 |
|
1728 |
sysHandle1 := aHandle sysHandle1. |
|
1729 |
sysHandle2 := aHandle sysHandle2. |
|
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1730 |
pathName := aHandle pathName. |
141 | 1731 |
|
1732 |
%{ /* STACK: 20000 */ |
|
1733 |
||
1734 |
#ifdef GNU_DL |
|
1735 |
{ |
|
1736 |
void (*func)(); |
|
2998 | 1737 |
unsigned INT addr; |
141 | 1738 |
char *name; |
1739 |
||
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
1740 |
if (__isStringLike(aString)) { |
3001 | 1741 |
name = (char *) __stringVal(aString); |
1742 |
if (isFunction == false) { |
|
1743 |
addr = dld_get_symbol(name); |
|
1744 |
if (addr) { |
|
1745 |
if (@global(Verbose) == true) { |
|
1746 |
console_printf("addr of %s = %x\n", name, addr); |
|
1747 |
} |
|
1748 |
address = __MKUINT( addr ); |
|
1749 |
} |
|
1750 |
} else { |
|
1751 |
func = (void (*) ()) dld_get_func(name); |
|
1752 |
if (func) { |
|
1753 |
if (@global(Verbose) == true) { |
|
1754 |
console_printf("addr of %s = %x\n", name, (INT)func); |
|
1755 |
} |
|
1756 |
if (dld_function_executable_p(name)) { |
|
1757 |
address = __MKUINT( (INT)func ); |
|
1758 |
} else { |
|
1759 |
char **undefNames; |
|
1760 |
char **nm; |
|
1761 |
int i; |
|
1762 |
||
1763 |
if (@global(Verbose) == true) { |
|
1764 |
console_printf ("function %s not executable\n", name); |
|
1765 |
dld_perror("not executable"); |
|
1766 |
||
1767 |
console_printf("undefined:\n"); |
|
1768 |
nm = undefNames = dld_list_undefined_sym(); |
|
1769 |
for (i=dld_undefined_sym_count; i; i--) { |
|
1770 |
console_printf(" %s\n", *nm++); |
|
1771 |
} |
|
1772 |
free(undefNames); |
|
1773 |
} |
|
1774 |
} |
|
1775 |
} else { |
|
1776 |
if (@global(Verbose) == true) { |
|
1777 |
console_printf ("function %s not found\n", name); |
|
1778 |
dld_perror("get_func"); |
|
1779 |
} |
|
1780 |
} |
|
1781 |
} |
|
141 | 1782 |
} |
1783 |
} |
|
1784 |
#endif /* GNU_DL */ |
|
1785 |
||
180 | 1786 |
#ifdef WIN_DL |
1787 |
{ |
|
1788 |
void *h; |
|
1789 |
void *addr; |
|
701 | 1790 |
INT val; |
180 | 1791 |
FARPROC entry; |
1792 |
HMODULE handle; |
|
1793 |
||
1794 |
if (__bothSmallInteger(sysHandle1, sysHandle2)) { |
|
3001 | 1795 |
# if __POINTER_SIZE__ == 8 |
1796 |
val = (_intVal(sysHandle2) << 32) + _intVal(sysHandle1); |
|
1797 |
# else |
|
1798 |
val = (_intVal(sysHandle2) << 16) + _intVal(sysHandle1); |
|
1799 |
# endif |
|
1800 |
handle = (HMODULE)(val); |
|
1801 |
if (__isStringLike(aString)) { |
|
1802 |
if (@global(Verbose) == true) |
|
1803 |
console_printf("get sym <%s> handle = %"_lx_"\n", __stringVal(aString), (INT)handle); |
|
1804 |
entry = GetProcAddress(handle, (char *) __stringVal(aString)); |
|
1805 |
if (entry != NULL) { |
|
1806 |
addr = (void *)entry; |
|
1807 |
if (@global(Verbose) == true) { |
|
1808 |
console_printf("GetProcAddr %s ok; addr = %"_lx_"\n", __stringVal(aString), (INT)addr); |
|
1809 |
} |
|
1810 |
address = __MKUINT( (int)addr ); |
|
1811 |
} else { |
|
1812 |
if (@global(Verbose) == true) { |
|
1813 |
console_printf("GetProcAddr %s error: %x\n", __stringVal(aString), GetLastError()); |
|
1814 |
} |
|
1815 |
} |
|
1816 |
} |
|
180 | 1817 |
} |
1818 |
} |
|
1819 |
#endif |
|
1820 |
||
906 | 1821 |
#ifdef BEOS_DL |
1822 |
{ |
|
1823 |
void *h; |
|
1824 |
void *addr; |
|
1825 |
INT val; |
|
1826 |
void *handle; |
|
1827 |
||
1828 |
if (__bothSmallInteger(sysHandle1, sysHandle2)) { |
|
3001 | 1829 |
# if __POINTER_SIZE__ == 8 |
1830 |
val = (_intVal(sysHandle2) << 32) + _intVal(sysHandle1); |
|
1831 |
# else |
|
1832 |
val = (_intVal(sysHandle2) << 16) + _intVal(sysHandle1); |
|
1833 |
# endif |
|
1834 |
handle = (void *)(val); |
|
1835 |
||
1836 |
if (__isStringLike(aString)) { |
|
1837 |
if (@global(Verbose) == true) |
|
1838 |
console_printf("get sym <%s> handle = %x\n", __stringVal(aString), (int)handle); |
|
1839 |
entry = NULL; |
|
1840 |
get_image_symbol((image_id) handle, (char *) __stringVal(aString), B_SYMBOL_TYPE_TEXT, &entry); |
|
1841 |
if (entry != NULL) { |
|
1842 |
addr = (void *)entry; |
|
1843 |
if (@global(Verbose) == true) { |
|
1844 |
console_printf("get_image_symbol %s ok; addr = %x\n", __stringVal(aString), addr); |
|
1845 |
} |
|
1846 |
address = __MKUINT( (int)addr ); |
|
1847 |
} else { |
|
1848 |
if (@global(Verbose) == true) { |
|
1849 |
console_printf("get_image_symbol %s error\n", __stringVal(aString)); |
|
1850 |
} |
|
1851 |
} |
|
1852 |
} |
|
906 | 1853 |
} |
1854 |
} |
|
1855 |
#endif |
|
1856 |
||
141 | 1857 |
#ifdef DL1_6 |
1858 |
{ |
|
1859 |
void *h; |
|
1860 |
void *addr; |
|
701 | 1861 |
INT val; |
141 | 1862 |
|
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
1863 |
if (__isStringLike(aString)) { |
3001 | 1864 |
if (__isStringLike(sysHandle1)) { |
1865 |
if (@global(Verbose) == true) |
|
1866 |
console_printf("get sym <%s> handle = %x\n", |
|
1867 |
__stringVal(aString), __stringVal(sysHandle1)); |
|
1868 |
addr = dl_getsymbol(__stringVal(sysHandle1), __stringVal(aString)); |
|
1869 |
if (addr) { |
|
1870 |
if (@global(Verbose) == true) |
|
1871 |
console_printf("addr = %x\n", addr); |
|
1872 |
address = __MKUINT( (int)addr ); |
|
1873 |
} else { |
|
1874 |
if (@global(Verbose) == true) |
|
1875 |
console_printf("dl_getsymbol %s failed\n", __stringVal(aString)); |
|
1876 |
} |
|
1877 |
} |
|
141 | 1878 |
} |
1879 |
} |
|
1880 |
#endif |
|
1881 |
||
1882 |
#ifdef SYSV4_DL |
|
1883 |
{ |
|
1884 |
void *h; |
|
1885 |
void *addr; |
|
701 | 1886 |
INT val; |
141 | 1887 |
OBJ low = sysHandle1, hi = sysHandle2; |
701 | 1888 |
extern void *dlsym(); |
141 | 1889 |
|
1890 |
if (__bothSmallInteger(low, hi)) { |
|
3001 | 1891 |
# if __POINTER_SIZE__ == 8 |
1892 |
val = (__intVal(hi) << 32) + __intVal(low); |
|
1893 |
# else |
|
1894 |
val = (__intVal(hi) << 16) + __intVal(low); |
|
1895 |
# endif |
|
1896 |
h = (void *)(val); |
|
1897 |
if (__isStringLike(aString)) { |
|
1898 |
if (@global(Verbose) == true) { |
|
1899 |
console_printf("get sym <%s> handle = %"_lx_"\n", __stringVal(aString), (INT)h); |
|
1900 |
} |
|
1901 |
addr = dlsym(h, (char *) __stringVal(aString)); |
|
1902 |
if (addr) { |
|
1903 |
if (@global(Verbose) == true) { |
|
1904 |
console_printf("dlsym %s ok; addr = %"_lx_"\n", __stringVal(aString), (INT)addr); |
|
1905 |
} |
|
1906 |
address = __MKUINT( (INT)addr ); |
|
1907 |
} else { |
|
1908 |
if (@global(Verbose) == true) { |
|
1909 |
console_printf("dlsym %s error: %s\n", __stringVal(aString), dlerror()); |
|
1910 |
} |
|
1911 |
} |
|
1912 |
} |
|
141 | 1913 |
} |
1914 |
} |
|
1915 |
#endif |
|
1916 |
||
523 | 1917 |
#ifdef HPUX10_DL |
1918 |
{ |
|
1919 |
void *h; |
|
1920 |
void *addr; |
|
701 | 1921 |
INT val, ret; |
523 | 1922 |
OBJ low = sysHandle1, hi = sysHandle2; |
1923 |
||
1924 |
if (__bothSmallInteger(low, hi)) { |
|
3001 | 1925 |
# if __POINTER_SIZE__ == 8 |
1926 |
val = (__intVal(hi) << 32) + __intVal(low); |
|
1927 |
# else |
|
1928 |
val = (_intVal(hi) << 16) + _intVal(low); |
|
1929 |
# endif |
|
1930 |
h = (void *)(val); |
|
1931 |
if (__isStringLike(aString)) { |
|
1932 |
if (@global(Verbose) == true) { |
|
1933 |
console_printf("get sym <%s> handle = %x\n", __stringVal(aString), h); |
|
1934 |
} |
|
1935 |
ret = shl_findsym(h, __stringVal(aString), TYPE_UNDEFINED, &addr); |
|
1936 |
if (ret != 0) { |
|
1937 |
if (@global(Verbose) == true) { |
|
1938 |
console_printf("dlsym %s error; errno=%d\n", __stringVal(aString), errno); |
|
1939 |
} |
|
1940 |
} else { |
|
1941 |
if (@global(Verbose) == true) { |
|
1942 |
console_printf("dlsym %s ok; addr = %x\n", __stringVal(aString), addr); |
|
1943 |
} |
|
1944 |
address = __MKUINT( (INT)addr ); |
|
1945 |
} |
|
1946 |
} |
|
523 | 1947 |
} |
1948 |
} |
|
1949 |
#endif |
|
1950 |
||
1951 |
||
141 | 1952 |
#ifdef AIX_DL |
1953 |
{ |
|
1954 |
void *h; |
|
1955 |
void *addr; |
|
3001 | 1956 |
INT val; |
141 | 1957 |
struct nlist nl[2]; |
1958 |
OBJ low = sysHandle1, hi = sysHandle2; |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1959 |
char nameBuffer[256]; |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1960 |
static struct funcDescriptor { |
3001 | 1961 |
unsigned vaddr; |
1962 |
unsigned long2; |
|
1963 |
unsigned long3; |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1964 |
} descriptor; |
141 | 1965 |
|
1966 |
if (__bothSmallInteger(low, hi) |
|
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
1967 |
&& __isStringLike(aString) && __isStringLike(pathName)) { |
3001 | 1968 |
# if __POINTER_SIZE__ == 8 |
1969 |
val = (__intVal(hi) << 32) + __intVal(low); |
|
1970 |
# else |
|
1971 |
val = (__intVal(hi) << 16) + __intVal(low); |
|
1972 |
# endif |
|
1973 |
h = (void *)(val); |
|
1974 |
||
1975 |
if (@global(Verbose) == true) { |
|
1976 |
console_printf("get sym <%s> handle = %x path= %s\n", |
|
1977 |
__stringVal(aString), h, __stringVal(pathName)); |
|
1978 |
} |
|
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
1979 |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1980 |
#define USE_ENTRY |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1981 |
#ifdef USE_ENTRY |
3001 | 1982 |
/* |
1983 |
* only works, if the entry-function is the Init function |
|
1984 |
* (i.e. linked with -e _xxx_Init) |
|
1985 |
*/ |
|
1986 |
if (@global(Verbose) == true) { |
|
1987 |
console_printf("returned handle as addr = %x\n", h); |
|
1988 |
} |
|
1989 |
address = __MKUINT( (int)(h) ); |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1990 |
#else |
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1991 |
|
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1992 |
# ifdef USE_DESCRIPTOR |
3001 | 1993 |
if (isFunction == true) { |
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1994 |
# else |
3001 | 1995 |
if (0) { |
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
1996 |
# endif |
3001 | 1997 |
nameBuffer[0] = '.'; |
1998 |
strcpy(nameBuffer+1, aString); |
|
1999 |
nl[0].n_name = nameBuffer; |
|
2000 |
} else { |
|
2001 |
nl[0].n_name = __stringVal(aString); |
|
2002 |
} |
|
2003 |
nl[1].n_name = ""; |
|
2004 |
||
2005 |
if (nlist(__stringVal(pathName), &nl) == -1) { |
|
2006 |
if (@global(Verbose) == true) { |
|
2007 |
console_printf("nlist error\n"); |
|
2008 |
} |
|
2009 |
} else { |
|
2010 |
addr = (void *)((unsigned)nl[0].n_value + (unsigned)h); |
|
2011 |
||
2012 |
if (isFunction == true) { |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2013 |
# ifdef USE_DESCRIPTOR |
3001 | 2014 |
console_printf("daddr = %x\n", addr); |
2015 |
console_printf("daddr[0] = %x\n", ((long *)addr)[0]); |
|
2016 |
console_printf("daddr[1] = %x\n", ((long *)addr)[1]); |
|
2017 |
console_printf("daddr[2] = %x\n", ((long *)addr)[2]); |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2018 |
# endif |
3001 | 2019 |
} |
2020 |
||
2021 |
if (@global(Verbose) == true) { |
|
2022 |
console_printf("value=%x section=%d type=%x sclass=%d\n", |
|
2023 |
nl[0].n_value, nl[0].n_scnum, nl[0].n_type, nl[0].n_sclass); |
|
2024 |
console_printf("vaddr = %x\n", addr); |
|
2025 |
} |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2026 |
# ifdef DOES_NOT_WORK |
3001 | 2027 |
address = __MKUINT( (int)addr ); |
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2028 |
# else |
3001 | 2029 |
descriptor.vaddr = (unsigned) addr; |
2030 |
descriptor.long2 = 0; |
|
2031 |
descriptor.long3 = 0; |
|
2032 |
address = __MKUINT( (int)(&descriptor) ); |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2033 |
# endif |
3001 | 2034 |
} |
2998 | 2035 |
#endif /* don't USE_ENTRY */ |
141 | 2036 |
} |
2037 |
} |
|
321
9428bae4c62e
dynamic loading for aix fixed
Claus Gittinger <cg@exept.de>
parents:
320
diff
changeset
|
2038 |
#endif /* AIX_DL */ |
141 | 2039 |
|
523 | 2040 |
|
141 | 2041 |
#ifdef SUN_DL |
2042 |
{ |
|
2043 |
void *h; |
|
2044 |
void *addr; |
|
2045 |
int val; |
|
2046 |
OBJ low = sysHandle1, hi = sysHandle2; |
|
2047 |
||
2048 |
if (__bothSmallInteger(low, hi)) { |
|
3001 | 2049 |
val = (_intVal(hi) << 16) + _intVal(low); |
2050 |
h = (void *)(val); |
|
2051 |
if (__isStringLike(aString)) { |
|
2052 |
if (@global(Verbose) == true) { |
|
2053 |
console_printf("get sym <%s> handle = %x\n", __stringVal(aString), h); |
|
2054 |
} |
|
2055 |
addr = dlsym(h, __stringVal(aString)); |
|
2056 |
if (addr) { |
|
2057 |
if (@global(Verbose) == true) { |
|
2058 |
console_printf("addr = %x\n", addr); |
|
2059 |
} |
|
2060 |
address = __MKUINT( (int)addr ); |
|
2061 |
} else { |
|
2062 |
if (@global(Verbose) == true) { |
|
2063 |
console_printf("dlsym %s error: %s\n", __stringVal(aString), dlerror()); |
|
2064 |
} |
|
2065 |
} |
|
2066 |
} |
|
141 | 2067 |
} |
2068 |
} |
|
2069 |
#endif |
|
2070 |
||
523 | 2071 |
|
141 | 2072 |
#ifdef NEXT_DL |
2073 |
{ |
|
2074 |
unsigned long addr; |
|
2075 |
long result; |
|
2076 |
NXStream *errOut; |
|
2077 |
||
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
2078 |
if (__isStringLike(aString)) { |
3001 | 2079 |
if (@global(Verbose) == true) { |
2080 |
console_printf("get sym <%s>\n", __stringVal(aString)); |
|
2081 |
} |
|
2082 |
errOut = NXOpenFile(2, 2); |
|
2083 |
result = rld_lookup(errOut, |
|
2084 |
(char *) __stringVal(aString), |
|
2085 |
&addr); |
|
2086 |
NXClose(errOut); |
|
2087 |
if (result) { |
|
2088 |
if (@global(Verbose) == true) { |
|
2089 |
console_printf("addr = %x\n", addr); |
|
2090 |
} |
|
2091 |
address = __MKUINT( (int)addr ); |
|
2092 |
} |
|
141 | 2093 |
} |
2094 |
} |
|
2095 |
#endif |
|
180 | 2096 |
|
141 | 2097 |
%}. |
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2098 |
^ address |
141 | 2099 |
! |
2100 |
||
2101 |
hasUndefinedSymbolsIn:handle |
|
259 | 2102 |
"return true, if a module has undefined symbols in it. |
2103 |
This is only possible if the system supports loading |
|
2104 |
modules with undefined things in it - most do not" |
|
2105 |
||
141 | 2106 |
^ (self getListOfUndefinedSymbolsFrom:handle) size > 0 |
259 | 2107 |
|
2108 |
"Modified: 25.4.1996 / 09:47:27 / cg" |
|
141 | 2109 |
! |
2110 |
||
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
2111 |
initFunctionBasenameForFile:pathNameOrFilename |
3006 | 2112 |
"return the expected initFunction's name, given a fileName" |
2113 |
||
2114 |
|fileName name suffixLen| |
|
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2115 |
|
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2116 |
" |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2117 |
first, expect the classes-name to be the fileName-base |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2118 |
" |
3006 | 2119 |
fileName := pathNameOrFilename asFilename. |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2120 |
suffixLen := 0. |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2121 |
self validBinaryExtensions do:[:suffix | |
3006 | 2122 |
suffixLen == 0 ifTrue:[ |
2123 |
(fileName hasSuffix:suffix) ifTrue:[ |
|
2124 |
suffixLen := suffix size + 1 |
|
2125 |
] |
|
2126 |
] |
|
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2127 |
]. |
3006 | 2128 |
name := fileName baseName. |
403 | 2129 |
|
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2130 |
suffixLen ~~ 0 ifTrue:[ |
3154
9fb144482c78
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
3107
diff
changeset
|
2131 |
name := name copyButLast:suffixLen |
3006 | 2132 |
] ifFalse:[ |
2133 |
('ObjectFileLoader [warning]: invalid binary object file suffix in: ',fileName name) infoPrintCR. |
|
2134 |
name := fileName withoutSuffix baseName |
|
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2135 |
]. |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2136 |
^ name. |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2137 |
|
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2138 |
" |
3006 | 2139 |
ObjectFileLoader initFunctionBasenameForFile:'libstx_libbasic.so' (unix) |
2140 |
ObjectFileLoader initFunctionBasenameForFile:'libstx_libbasic.dll' (msdos) |
|
2141 |
ObjectFileLoader initFunctionBasenameForFile:'demo.so' |
|
2142 |
ObjectFileLoader initFunctionBasenameForFile:'demo.o' |
|
2143 |
ObjectFileLoader initFunctionBasenameForFile:'demo.obj' |
|
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2144 |
" |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2145 |
|
784
c8742d9efcb6
suffix fix for systems with caseless filenames
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
2146 |
"Created: / 13.7.1996 / 00:01:54 / cg" |
c8742d9efcb6
suffix fix for systems with caseless filenames
Claus Gittinger <cg@exept.de>
parents:
782
diff
changeset
|
2147 |
"Modified: / 1.10.1998 / 12:47:50 / cg" |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2148 |
! |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
2149 |
|
141 | 2150 |
isCPlusPlusObject:handle |
259 | 2151 |
"return true, if the loaded object is a c++ object module. |
2152 |
This is not yet fully implemented/supported." |
|
141 | 2153 |
|
2154 |
(self getSymbol:'__gnu_compiled_cplusplus' function:true from:handle) notNil ifTrue:[^ true]. |
|
2155 |
(self getSymbol:'__CTOR_LIST__' function:true from:handle) notNil ifTrue:[^ true]. |
|
2156 |
(self getSymbol:'__CTOR_LIST__' function:false from:handle) notNil ifTrue:[^ true]. |
|
2157 |
(self getSymbol:'__gnu_compiled_cplusplus' function:false from:handle) notNil ifTrue:[^ true]. |
|
6 | 2158 |
^ false |
259 | 2159 |
|
2160 |
"Modified: 25.4.1996 / 09:48:19 / cg" |
|
0 | 2161 |
! |
2162 |
||
141 | 2163 |
isObjectiveCObject:handle |
259 | 2164 |
"return true, if the loaded object is an objective-C object module. |
2165 |
This is not yet implemented/supported" |
|
141 | 2166 |
|
2167 |
^ false |
|
259 | 2168 |
|
2169 |
"Modified: 25.4.1996 / 09:47:59 / cg" |
|
141 | 2170 |
! |
2171 |
||
2172 |
isSmalltalkObject:handle |
|
2173 |
"return true, if the loaded object is a smalltalk object module" |
|
2174 |
||
2175 |
"not yet implemented - stc_compiled_smalltalk is a static symbol, |
|
2176 |
not found in list - need nm-interface, or nlist-walker |
|
2177 |
" |
|
2178 |
^ true. |
|
2179 |
||
365
22c85186e799
Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
346
diff
changeset
|
2180 |
"/ (self getSymbol:'__stc_compiled_smalltalk' function:true from:handle) notNil ifTrue:[^ true]. |
22c85186e799
Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
346
diff
changeset
|
2181 |
"/ (self getSymbol:'__stc_compiled_smalltalk' function:false from:handle) notNil ifTrue:[^ true]. |
22c85186e799
Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
346
diff
changeset
|
2182 |
"/ ^ false |
141 | 2183 |
! |
2184 |
||
2185 |
listUndefinedSymbolsIn:handle |
|
259 | 2186 |
"list undefined objects in a module on the transcript" |
2187 |
||
141 | 2188 |
|undefinedNames| |
2189 |
||
2190 |
undefinedNames := self getListOfUndefinedSymbolsFrom:handle. |
|
2191 |
undefinedNames size > 0 ifTrue:[ |
|
468 | 2192 |
Transcript showCR:'undefined:'. |
2193 |
undefinedNames do:[:aName | |
|
2194 |
Transcript showCR:' ' , aName |
|
2195 |
] |
|
141 | 2196 |
]. |
259 | 2197 |
|
272 | 2198 |
"Modified: 18.5.1996 / 15:43:45 / cg" |
141 | 2199 |
! |
2200 |
||
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
2201 |
namesMatching:aPattern segment:segmentPattern in:aPathName |
521 | 2202 |
"search for entries which match a pattern. |
2203 |
This is obsolete & rubbish - it will vanish soon" |
|
141 | 2204 |
|
2205 |
|p l s addr segment name entry| |
|
2206 |
||
766 | 2207 |
OperatingSystem isVMSlike ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2208 |
"/ no nm command |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2209 |
^ nil |
766 | 2210 |
]. |
2211 |
OperatingSystem isMSDOSlike ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2212 |
"/ no nm command |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2213 |
^ nil |
609 | 2214 |
]. |
521 | 2215 |
OperatingSystem getOSType = 'aix' ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2216 |
"/ no useful nm info |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2217 |
^ nil |
749 | 2218 |
]. |
141 | 2219 |
|
2220 |
l := OrderedCollection new. |
|
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
2221 |
p := PipeStream readingFrom:(self nm:aPathName). |
141 | 2222 |
p isNil ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2223 |
('ObjectFileLoader [info]: cannot read names from ' , aPathName) infoPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2224 |
^ nil |
141 | 2225 |
]. |
2226 |
[p atEnd] whileFalse:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2227 |
entry := p nextLine. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2228 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2229 |
entry errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2230 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2231 |
entry notNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2232 |
s := ReadStream on:entry. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2233 |
addr := s nextAlphaNumericWord. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2234 |
s skipSeparators. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2235 |
segment := s upToSeparator. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2236 |
s skipSeparators. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2237 |
name := s upToEnd withoutSeparators. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2238 |
(addr notNil and:[segment notNil and:[name notNil]]) ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2239 |
(aPattern match:name) ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2240 |
(segmentPattern isNil or:[segmentPattern match:segment]) ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2241 |
l add:name. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2242 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2243 |
('found name: ' , name) errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2244 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2245 |
] ifFalse:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2246 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2247 |
name errorPrint. ' segment mismatch ' errorPrint. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2248 |
segmentPattern errorPrint. ' ' errorPrint. segment errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2249 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2250 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2251 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2252 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2253 |
] |
0 | 2254 |
]. |
141 | 2255 |
p close. |
2256 |
^ l |
|
225 | 2257 |
|
749 | 2258 |
"Modified: / 27.7.1998 / 20:10:57 / cg" |
141 | 2259 |
! |
2260 |
||
2261 |
releaseSymbolTable |
|
2262 |
"this is needed on NeXT to forget loaded names. If this wasnt done, |
|
2263 |
the same class could not be loaded in again due to multiple defines. |
|
2264 |
On other architectures, this is not needed and therefore a noop." |
|
2265 |
||
2266 |
%{ |
|
2267 |
#ifdef NEXT_DL |
|
2268 |
NXStream *errOut; |
|
2269 |
||
2270 |
errOut = NXOpenFile(2, 2); |
|
2271 |
rld_unload_all(errOut, (long)0); |
|
2272 |
rld_load_basefile(errOut, "smalltalk"); |
|
2273 |
NXClose(errOut); |
|
2274 |
#endif |
|
2275 |
%} |
|
303 | 2276 |
! ! |
2277 |
||
369 | 2278 |
!ObjectFileLoader class methodsFor:'image save/restart'! |
303 | 2279 |
|
2280 |
invalidateAndRememberAllObjectFiles |
|
2281 |
"invalidate code refs into all dynamically loaded object files. |
|
2282 |
Required before writing a snapshot image." |
|
2283 |
||
2284 |
LoadedObjects notNil ifTrue:[ |
|
468 | 2285 |
ActuallyLoadedObjects := LoadedObjects. |
2286 |
self rememberAllObjectFiles. |
|
2287 |
ActuallyLoadedObjects keys do:[:aFileName | |
|
2288 |
|handle| |
|
2289 |
||
2290 |
handle := ActuallyLoadedObjects at:aFileName. |
|
2291 |
handle isNil ifTrue:[ |
|
2292 |
self error:'oops, no handle'. |
|
2293 |
] ifFalse:[ |
|
2294 |
(handle isClassLibHandle or:[handle isMethodHandle]) ifTrue:[ |
|
2295 |
self invalidateModule:handle |
|
2296 |
] |
|
2297 |
] |
|
2298 |
]. |
|
2299 |
LoadedObjects := nil. |
|
303 | 2300 |
]. |
2301 |
||
2302 |
"Created: 5.10.1995 / 15:48:56 / claus" |
|
2303 |
"Modified: 5.10.1995 / 16:48:51 / claus" |
|
2304 |
"Modified: 12.7.1996 / 17:13:45 / cg" |
|
28 | 2305 |
! |
6 | 2306 |
|
303 | 2307 |
reloadAllRememberedObjectFiles |
2308 |
"reload all object modules as were loaded when the image was saved. |
|
2309 |
Some care has to be taken, if files are missing or otherwise corrupted." |
|
2310 |
||
2882
e7fb69ba1a54
Fix #loadObjectFile:invokeInitializeMethods: for snapshot reload
Stefan Vogel <sv@exept.de>
parents:
2806
diff
changeset
|
2311 |
|oldDummyMethod who newHandle |
e7fb69ba1a54
Fix #loadObjectFile:invokeInitializeMethods: for snapshot reload
Stefan Vogel <sv@exept.de>
parents:
2806
diff
changeset
|
2312 |
savedOldClasses functions saveOldMethodsPerClass anyModulesToInitialize m| |
303 | 2313 |
|
2314 |
PreviouslyLoadedObjects notNil ifTrue:[ |
|
2919 | 2315 |
anyModulesToInitialize := false. |
2316 |
||
2317 |
PreviouslyLoadedObjects do:[:entry | |
|
2318 |
|fileName handle cls sel| |
|
2319 |
||
2320 |
fileName := entry key. |
|
2321 |
handle := entry value. |
|
2322 |
handle moduleID:nil. |
|
2323 |
||
2324 |
handle isClassLibHandle ifTrue:[ |
|
2325 |
"/ ('ObjectFileLoader [info]: reloading classes in ' , fileName , ' ...') infoPrintCR. |
|
2326 |
||
2327 |
"/ |
|
2328 |
"/ remember all byteCode methods (as added in the session) |
|
2329 |
"/ |
|
2330 |
savedOldClasses := IdentitySet new. |
|
2331 |
saveOldMethodsPerClass := IdentityDictionary new. |
|
2332 |
||
2333 |
handle classes do:[:eachClass | |
|
2334 |
(eachClass notNil and:[eachClass ~~ 0]) ifTrue:[ |
|
2335 |
saveOldMethodsPerClass at:eachClass put:eachClass methodDictionary copy. |
|
2336 |
savedOldClasses add:eachClass. |
|
2337 |
]. |
|
2338 |
]. |
|
2339 |
"/ |
|
2340 |
"/ load the class binary |
|
2341 |
"/ |
|
2342 |
handle := self loadObjectFile:fileName invokeInitializeMethods:false. |
|
2343 |
handle notNil ifTrue:[ |
|
2344 |
anyModulesToInitialize := true |
|
2345 |
]. |
|
2346 |
||
2347 |
"/ after reloading of the objectFile, |
|
2348 |
"/ some of the changes made in the previous life have to be |
|
2349 |
"/ redone here - otherwise, we will be left with the |
|
2350 |
"/ state contained in the loaded objectModule - instead of |
|
2351 |
"/ what we had when saving the image ... |
|
2352 |
||
2353 |
||
2354 |
"/ |
|
2355 |
"/ re-remove removed methods |
|
2356 |
"/ and re-change method categories |
|
2357 |
"/ |
|
2358 |
savedOldClasses do:[:oldClass | |
|
2359 |
|newClass oldMethods newMethodDict newMthd |
|
2360 |
oldCat oldClassVarString oldClassCategory| |
|
2361 |
||
2362 |
newClass := Smalltalk classNamed:(oldClass name). |
|
2363 |
newClass notNil ifTrue:[ |
|
2364 |
oldClassVarString := oldClass classVariableString. |
|
2365 |
newClass classVariableString ~= oldClassVarString ifTrue:[ |
|
2366 |
"/ there is no need to recreate the variable |
|
2367 |
"/ (its in the smalltalk dictionary) |
|
2368 |
newClass setClassVariableString:oldClassVarString |
|
2369 |
]. |
|
2370 |
newClass isMeta ifFalse:[ |
|
2371 |
newClass setSharedPoolNames:(oldClass sharedPoolNames). |
|
2372 |
oldClassCategory := oldClass category. |
|
2373 |
newClass category ~= oldClassCategory ifTrue:[ |
|
2374 |
newClass setCategory:oldClassCategory |
|
2375 |
] |
|
2376 |
]. |
|
2377 |
oldMethods := saveOldMethodsPerClass at:oldClass. |
|
2378 |
newMethodDict := newClass methodDictionary. |
|
2379 |
oldMethods keysAndValuesDo:[:selector :oldMethod| |
|
2380 |
oldMethod |
|
2381 |
code:nil; |
|
2382 |
mclass:self. |
|
2383 |
oldMethod byteCode isNil ifTrue:[ |
|
2384 |
"a compiled method, load the new code (addresses may have been changed)" |
|
2385 |
newMthd := newMethodDict at:selector ifAbsent:nil. |
|
2386 |
newMthd notNil ifTrue:[ |
|
2387 |
oldMethod code:newMthd code. |
|
2388 |
] ifFalse:[ |
|
2389 |
('ObjectFileLoader [warning]: ' , oldClass name , ' missing method: ', selector, '.') errorPrintCR. |
|
2390 |
]. |
|
2391 |
]. |
|
2392 |
]. |
|
2393 |
newClass setMethodDictionary:oldMethods. |
|
2394 |
]. |
|
2395 |
]. |
|
2396 |
||
2397 |
"/ |
|
2398 |
"/ validate old-classes vs. new classes. |
|
2399 |
"/ and if things look ok, get rid of old stuff |
|
2400 |
"/ and make instances become instances of the new class |
|
2401 |
"/ |
|
638 | 2402 |
"/ ('ObjectFileLoader [info]: migrating classes ...') infoPrintCR. |
2403 |
||
2919 | 2404 |
savedOldClasses do:[:oldClass | |
2405 |
|newClass oldCat oldCVars| |
|
2406 |
||
2407 |
newClass := Smalltalk classNamed:(oldClass name). |
|
2408 |
newClass == oldClass ifTrue:[ |
|
474 | 2409 |
"/ ('ObjectFileLoader [info]: class ' , oldClass name , ' reloaded.') infoPrintCR. |
2919 | 2410 |
] ifFalse:[ |
2411 |
(newClass isNil or:[newClass == oldClass]) ifTrue:[ |
|
2412 |
('ObjectFileLoader [warning]: reload of ' , oldClass name , ' seemed to fail.') errorPrintCR. |
|
2413 |
] ifFalse:[ |
|
303 | 2414 |
"/'oldSize: ' print. oldClass instSize print. ' (' print. oldClass instSize class name print. ') ' print. |
2415 |
"/'newSize: ' print. newClass instSize print. ' (' print. oldClass instSize class name print. ') ' printCR. |
|
2416 |
||
2919 | 2417 |
oldClass instSize ~~ newClass instSize ifTrue:[ |
2418 |
('ObjectFileLoader [warning]: ' , oldClass name , ' has changed its size.') errorPrintCR. |
|
2419 |
] ifFalse:[ |
|
2420 |
oldClass class instSize ~~ newClass class instSize ifTrue:[ |
|
2421 |
('ObjectFileLoader [warning]: ' , oldClass name , ' class has changed its size.') errorPrintCR. |
|
2422 |
] ifFalse:[ |
|
638 | 2423 |
"/ ('ObjectFileLoader [info]: migrating ' , oldClass name) infoPrintCR. |
2919 | 2424 |
(oldCat := oldClass category) ~= newClass category ifTrue:[ |
2425 |
newClass setCategory:oldCat. |
|
2426 |
]. |
|
2427 |
(oldCVars := oldClass classVariableString) ~= newClass classVariableString ifTrue:[ |
|
2428 |
newClass setClassVariableString:oldCVars |
|
2429 |
]. |
|
2430 |
"/ copy over the oldClasses class-instVars |
|
2431 |
(Class instSize + 1) to:(oldClass class instSize) do:[:idx | |
|
2432 |
newClass instVarAt:idx put:(oldClass instVarAt:idx) |
|
2433 |
]. |
|
2434 |
oldClass becomeSameAs:newClass |
|
638 | 2435 |
"/ oldClass become:newClass |
2919 | 2436 |
] |
2437 |
] |
|
2438 |
] |
|
2439 |
] |
|
2440 |
] |
|
2441 |
||
2442 |
] ifFalse:[ |
|
2443 |
handle isMethodHandle ifTrue:[ |
|
2444 |
oldDummyMethod := handle method. |
|
2445 |
(oldDummyMethod isKindOf:Method) ifFalse:[ |
|
2446 |
('ObjectFileLoader [info]: ignore obsolete (already collected) method in ' , fileName) infoPrintCR |
|
2447 |
] ifTrue:[ |
|
2448 |
('ObjectFileLoader [info]: reloading method in ' , fileName , ' ...') infoPrintCR. |
|
2449 |
who := oldDummyMethod who. |
|
2450 |
newHandle := self loadMethodObjectFile:fileName. |
|
2451 |
newHandle isNil ifTrue:[ |
|
2452 |
('ObjectFileLoader [warning]: failed to reload method in ' , fileName , ' ...') errorPrintCR. |
|
2453 |
handle moduleID:nil. |
|
2454 |
] ifFalse:[ |
|
2455 |
m := newHandle method. |
|
2456 |
oldDummyMethod sourceFilename notNil ifTrue:[ |
|
2457 |
m sourceFilename:(oldDummyMethod sourceFilename) |
|
2458 |
position:(oldDummyMethod sourcePosition). |
|
2459 |
] ifFalse:[ |
|
2460 |
m source:(oldDummyMethod source). |
|
2461 |
]. |
|
2462 |
m setPackage:(oldDummyMethod package). |
|
2463 |
who notNil ifTrue:[ |
|
2464 |
cls := who methodClass. |
|
2465 |
sel := who methodSelector. |
|
2466 |
m == (cls compiledMethodAt:sel) ifFalse:[ |
|
2467 |
'ObjectFileLoader [warning]: oops - loaded method installed wrong' errorPrintCR. |
|
2468 |
] ifTrue:[ |
|
303 | 2469 |
"/ cls changed:#methodDictionary with:(Array with:sel with:oldDummyMethod). |
2919 | 2470 |
] |
2471 |
]. |
|
2472 |
] |
|
2473 |
] |
|
2474 |
] ifFalse:[ |
|
2475 |
handle isFunctionObjectHandle ifTrue:[ |
|
2476 |
functions := handle functions. |
|
2477 |
functions isEmpty ifTrue:[ |
|
2478 |
('ObjectFileLoader [info]: ignore obsolete (unreferenced) functions in ' , fileName) infoPrintCR |
|
2479 |
] ifFalse:[ |
|
2480 |
newHandle := self loadDynamicObject:fileName. |
|
2481 |
newHandle isNil ifTrue:[ |
|
2482 |
('ObjectFileLoader [warning]: failed to reload ' , fileName , ' ...') errorPrintCR. |
|
2483 |
handle moduleID:nil. |
|
2484 |
] ifFalse:[ |
|
2485 |
('ObjectFileLoader [info]: reloading ' , fileName , ' ...') infoPrintCR. |
|
2486 |
functions do:[:eachFunction | |addr| |
|
2487 |
addr := newHandle getFunctionAddress:(eachFunction name) into:eachFunction. |
|
2488 |
addr isNil ifTrue:[ |
|
2489 |
('ObjectFileLoader [info]: function: ''' , eachFunction name , ''' no longer present.') errorPrintCR. |
|
2490 |
eachFunction invalidate. |
|
2491 |
] ifFalse:[ |
|
2492 |
eachFunction setModuleHandle:newHandle. |
|
2493 |
('ObjectFileLoader [info]: rebound function: ''' , eachFunction name , '''.') infoPrintCR. |
|
2494 |
] |
|
2495 |
]. |
|
2496 |
handle becomeSameAs:newHandle. "/ the old handle is now void |
|
2497 |
] |
|
2498 |
] |
|
2499 |
] ifFalse:[ |
|
2500 |
('ObjectFileLoader [info]: ignore invalid (obsolete) objectFile handle: ' , handle printString) infoPrintCR. |
|
2501 |
] |
|
2502 |
] |
|
2503 |
] |
|
2504 |
]. |
|
2505 |
PreviouslyLoadedObjects := nil. |
|
2506 |
||
2507 |
"/ now, as we hopefully have all loaded, |
|
2508 |
"/ send #reinitializeAfterLoad to each of them |
|
2509 |
anyModulesToInitialize ifTrue:[ |
|
2510 |
AbortOperationRequest catch:[ |
|
2511 |
self moduleInit:4 forceOld:false interruptable:true. |
|
2512 |
] |
|
2513 |
] |
|
303 | 2514 |
] |
2515 |
||
2472
8ae818e74044
changed: #reloadAllRememberedObjectFiles
Claus Gittinger <cg@exept.de>
parents:
2459
diff
changeset
|
2516 |
"Modified: / 18-01-2011 / 20:42:57 / cg" |
303 | 2517 |
! |
2518 |
||
2519 |
rememberAllObjectFiles |
|
2520 |
"remember all loaded objectModules in the |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
2521 |
PreviouslyLoadedObjects classVariable. |
303 | 2522 |
Called when an image is restarted to reload all modules which |
2523 |
were loaded in the previous life" |
|
2524 |
||
2525 |
LoadedObjects notNil ifTrue:[ |
|
2919 | 2526 |
PreviouslyLoadedObjects := OrderedCollection new. |
2527 |
LoadedObjects keysAndValuesDo:[:name :handle | |
|
2528 |
handle isObsolete ifTrue:[ |
|
2529 |
('ObjectFileLoader [info]: ignore object for already collected objects in ' , name) infoPrintCR |
|
2530 |
] ifFalse:[ |
|
2531 |
PreviouslyLoadedObjects add:(name -> handle) |
|
2532 |
] |
|
2533 |
]. |
|
2534 |
PreviouslyLoadedObjects sort:[:a :b | |
|
2535 |
|h1 h2| |
|
2536 |
||
2537 |
h1 := a value moduleID. |
|
2538 |
h2 := b value moduleID. |
|
2539 |
h1 isNil |
|
2540 |
ifTrue:[true] |
|
2541 |
ifFalse:[ |
|
2542 |
h2 isNil |
|
2543 |
ifTrue:[false] |
|
2544 |
ifFalse:[ |
|
2545 |
h1 < h2 |
|
2546 |
] |
|
2547 |
] |
|
2548 |
]. |
|
303 | 2549 |
] |
2550 |
||
2551 |
"Created: 5.12.1995 / 20:51:07 / cg" |
|
474 | 2552 |
"Modified: 10.1.1997 / 15:06:25 / cg" |
303 | 2553 |
! |
2554 |
||
2555 |
revalidateAllObjectFiles |
|
2556 |
"revalidate code refs into all dynamically loaded object files. |
|
2557 |
Required after writing a snapshot image." |
|
2558 |
||
2559 |
ActuallyLoadedObjects notNil ifTrue:[ |
|
468 | 2560 |
ActuallyLoadedObjects keys do:[:aFileName | |
2561 |
|handle| |
|
2562 |
||
2563 |
handle := ActuallyLoadedObjects at:aFileName. |
|
2564 |
handle isNil ifTrue:[ |
|
2565 |
self error:'oops, no handle'. |
|
2566 |
] ifFalse:[ |
|
2567 |
(handle isClassLibHandle or:[handle isMethodHandle]) ifTrue:[ |
|
2568 |
self revalidateModule:handle |
|
2569 |
] |
|
2570 |
] |
|
2571 |
]. |
|
2572 |
LoadedObjects := ActuallyLoadedObjects. |
|
2573 |
ActuallyLoadedObjects := PreviouslyLoadedObjects := nil. |
|
28 | 2574 |
]. |
141 | 2575 |
|
303 | 2576 |
"Created: 5.10.1995 / 15:49:08 / claus" |
2577 |
"Modified: 5.10.1995 / 16:49:18 / claus" |
|
2578 |
"Modified: 12.7.1996 / 17:14:48 / cg" |
|
2579 |
! |
|
2580 |
||
2581 |
unloadAllObjectFiles |
|
2582 |
"unload all dynamically loaded object files from the image. |
|
2583 |
see DANGER ALERT in ObjectFileLoader>>unloadObjectFile:" |
|
2584 |
||
2585 |
LoadedObjects notNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2586 |
LoadedObjects values copy do:[:eachHandle | |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2587 |
eachHandle notNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2588 |
self unloadDynamicObject:eachHandle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2589 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
2590 |
] |
303 | 2591 |
]. |
2592 |
||
2593 |
" |
|
2594 |
ObjectFileLoader unloadAllObjectFiles |
|
2595 |
" |
|
2596 |
! |
|
2597 |
||
2598 |
unloadAndRememberAllObjectFiles |
|
2599 |
"remember all modules and unload them" |
|
2600 |
||
2601 |
LoadedObjects notNil ifTrue:[ |
|
468 | 2602 |
self rememberAllObjectFiles. |
2603 |
self unloadAllObjectFiles |
|
303 | 2604 |
] |
2605 |
||
2606 |
"Modified: 25.4.1996 / 09:46:27 / cg" |
|
0 | 2607 |
! ! |
2608 |
||
369 | 2609 |
!ObjectFileLoader class methodsFor:'linking objects'! |
182
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2610 |
|
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2611 |
createLoadableObjectFor:baseFileName |
259 | 2612 |
"given an oFile, arrange for it to be loadable. |
2613 |
On ELF systems, this means that it has to be linked with the |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
2614 |
-shared option into a .so file; |
259 | 2615 |
DLD based loaders (linux a.out) can directly load a .o file; |
2616 |
Other systems may require more ..." |
|
2617 |
||
513 | 2618 |
|osType oFileName soFileName expFileName librunExpFileName |
3050 | 2619 |
needSharedObject ld ldArg expFile ok outfile output libDir libDirBasename |
3054 | 2620 |
errorMessage homeDir fmt| |
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2621 |
|
750
00bfa36237fb
changes for WIN32 - create a .DLL from a .OBJ using LINK
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
2622 |
osType := OperatingSystem getOSType. |
00bfa36237fb
changes for WIN32 - create a .DLL from a .OBJ using LINK
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
2623 |
|
2025
00f8564566e8
No need for a .def-file in win32 any longer
Stefan Vogel <sv@exept.de>
parents:
2012
diff
changeset
|
2624 |
osType = #win32 ifTrue:[ |
3011 | 2625 |
self activityNotification:'generating shared object'. |
2626 |
||
2627 |
ParserFlags linkArgs isNil ifTrue:[ |
|
2628 |
ld := self linkCommand , ' ' , baseFileName , '.obj'. |
|
2629 |
ld := ld |
|
2630 |
, ' /NOPACK /NOLOGO /DEBUG /MACHINE:I386 /DLL' |
|
2631 |
, ' /OUT:' , baseFileName , '.dll ' |
|
2025
00f8564566e8
No need for a .def-file in win32 any longer
Stefan Vogel <sv@exept.de>
parents:
2012
diff
changeset
|
2632 |
"/ , ' /DEF:' , baseFileName , '.def'. |
3011 | 2633 |
] ifFalse:[ |
2634 |
"/ libDir := ParserFlags libDirectory. |
|
2635 |
"/ (libDir notNil and:[libDir asFilename exists]) ifFalse:[ |
|
2636 |
ParserFlags useBorlandC ifTrue:[ |
|
2637 |
libDirBasename := 'lib\bc' |
|
2638 |
] ifFalse:[ |
|
2639 |
ParserFlags useVisualC ifTrue:[ |
|
2640 |
libDirBasename := 'lib\vc' |
|
2641 |
] ifFalse:[ |
|
2642 |
(ParserFlags useMingw32 or:[ParserFlags useMingw64]) ifTrue:[ |
|
2643 |
libDirBasename := 'lib\mingw' |
|
2644 |
] ifFalse:[ |
|
2645 |
libDirBasename := 'lib\vc' |
|
2646 |
] |
|
2647 |
] |
|
2648 |
]. |
|
3050 | 2649 |
homeDir := Smalltalk packagePath detect:[:p | (p asFilename / 'stx' / libDirBasename) exists] ifNone:nil. |
2650 |
homeDir notNil ifTrue:[ |
|
3051 | 2651 |
libDir := (homeDir asFilename / 'stx' / libDirBasename) pathName |
3050 | 2652 |
]. |
2653 |
libDir isNil ifTrue:[ |
|
2654 |
"/ some fallback |
|
2655 |
libDir := #( '..' |
|
2656 |
'..\..' |
|
2657 |
'..\..\..' |
|
2658 |
'..\..\stx' |
|
2659 |
'..\..\..\stx' |
|
2660 |
) detect:[:p | (p asFilename / libDirBasename) exists] ifNone:nil. |
|
2661 |
||
2662 |
libDir isNil ifTrue:[ |
|
2663 |
LastError := errorMessage := 'could not locate directory where .lib files are (',libDirBasename,')'. |
|
2664 |
ObjectFileLoadError raiseRequestErrorString:errorMessage. |
|
2665 |
^ nil |
|
2666 |
]. |
|
3011 | 2667 |
]. |
2668 |
"/ ]. |
|
2669 |
||
2670 |
ParserFlags useBorlandC ifTrue:[ |
|
2671 |
ld := self linkCommand , ' ' , (ParserFlags linkArgs bindWith:baseFileName). |
|
2672 |
ld := ld , ' c0d32.obj ' , baseFileName , '.obj '. |
|
2673 |
ld := ld , ',' , baseFileName , '.dll,,',libDir,'\librun.lib '. |
|
2674 |
ld := ld , (ParserFlags searchedLibraries asStringCollection asStringWith: $ ). |
|
2675 |
ld := ld , ' ',libDir,'\cs32i.lib,,'. |
|
2676 |
] ifFalse:[ |
|
2677 |
ParserFlags useVisualC ifTrue:[ |
|
2678 |
"/ todo: fix for correct link libs |
|
2679 |
ld := self linkCommand , ' ' , (ParserFlags linkArgs bindWith:baseFileName). |
|
2680 |
ld := ld , ' c0d32.obj ' , baseFileName , '.obj '. |
|
2681 |
ld := ld , ',' , baseFileName , '.dll,,',libDir,'\librun.lib '. |
|
2682 |
ld := ld , (ParserFlags searchedLibraries asStringCollection asStringWith: $ ). |
|
2683 |
ld := ld , ' ',libDir,'\cs32i.lib,,'. |
|
2684 |
] ifFalse:[ |
|
2685 |
(ParserFlags useMingw64 or:[ParserFlags useMingw32]) ifTrue:[ |
|
2686 |
ld := self linkCommand , ' ' , (ParserFlags linkArgs bindWith:baseFileName). |
|
2687 |
ld := ld , ' -shared -o ',baseFileName,'.dll '. |
|
2688 |
ld := ld , baseFileName,'.obj '. |
|
2689 |
ld := ld , libDir,'\librun.lib '. |
|
2690 |
ld := ld , (ParserFlags searchedLibraries asStringCollection asStringWith: $ ). |
|
2691 |
] ifFalse:[ |
|
2692 |
ObjectFileLoadError raiseRequestErrorString:'for dynamic objects, only borlandC is (currently) supported'. |
|
2693 |
LastError := 'for dynamic objects, only borlandC is (currently) supported'. |
|
2694 |
^ nil |
|
2695 |
] |
|
2696 |
] |
|
2697 |
] |
|
2698 |
]. |
|
2699 |
||
2700 |
outfile := (baseFileName , '.out'). |
|
3172 | 2701 |
(Verbose or:[ STCCompilerInterface verbose ]) ifTrue:[ |
2702 |
Transcript showCR:('executing: ',ld). |
|
2703 |
]. |
|
3011 | 2704 |
|
2705 |
ok := OperatingSystem executeCommand:(ld , ' >' , outfile). |
|
2706 |
ok ifFalse:[ |
|
2707 |
output := (baseFileName , '.out') asFilename contentsOfEntireFile. |
|
2708 |
Transcript showCR:output; endEntry. |
|
2709 |
Transcript showCR:'Failed linkCommand:'. |
|
2710 |
Transcript showCR:ld. |
|
2711 |
Transcript showCR:'ParserFlags are:'. |
|
2712 |
Transcript showCR:ParserFlags. |
|
2713 |
]. |
|
2714 |
||
2715 |
#('.obj' '.out' '.tds' '.ilc' '.ild' |
|
2716 |
'.ilf' '.ils' '.lib' '.map' '.def' '.o') do:[:eachSuffix| |
|
2717 |
(baseFileName , eachSuffix) asFilename delete. |
|
2718 |
]. |
|
2719 |
||
2720 |
ok ifFalse:[ |
|
2721 |
LastError := output. |
|
2722 |
"/ ObjectFileLoadError raiseRequestErrorString:'link failed'. |
|
2723 |
^ nil |
|
2724 |
]. |
|
2725 |
oFileName := (baseFileName , self sharedLibraryExtension) asFilename name. |
|
2726 |
^ oFileName |
|
750
00bfa36237fb
changes for WIN32 - create a .DLL from a .OBJ using LINK
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
2727 |
]. |
00bfa36237fb
changes for WIN32 - create a .DLL from a .OBJ using LINK
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
2728 |
|
00bfa36237fb
changes for WIN32 - create a .DLL from a .OBJ using LINK
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
2729 |
"/ UNIX systems |
00bfa36237fb
changes for WIN32 - create a .DLL from a .OBJ using LINK
Claus Gittinger <cg@exept.de>
parents:
749
diff
changeset
|
2730 |
|
2653
e228edb0b67a
changed: #createLoadableObjectFor:
Stefan Vogel <sv@exept.de>
parents:
2651
diff
changeset
|
2731 |
ld := self linkCommand ? 'ld'. |
188 | 2732 |
needSharedObject := false. |
722
add7cabbd2bb
fixed shared-library loading for solaris.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
2733 |
|
3054 | 2734 |
fmt := ObjectFileLoader loadableBinaryObjectFormat. |
2735 |
(fmt == #elf |
|
2736 |
or:[ fmt == #macho ]) ifTrue:[ |
|
3011 | 2737 |
" |
2738 |
link it to a shared object with 'ld -shared' |
|
2739 |
Currently, we support 32-bit objects only. |
|
2740 |
" |
|
2741 |
needSharedObject := true. |
|
2742 |
ld := self linkCommand ? 'cc'. |
|
3054 | 2743 |
ldArg := self linkSharedArgs. |
2744 |
ldArg isNil ifTrue:[ |
|
2745 |
"/ some default |
|
2746 |
ExternalAddress pointerSize == 4 ifTrue:[ |
|
2747 |
ldArg := '-m32 -shared'. |
|
2748 |
] ifFalse:[ |
|
2749 |
ldArg := '--shared'. |
|
2750 |
] |
|
2751 |
] |
|
3052 | 2752 |
]. |
2753 |
||
2935 | 2754 |
osType = #irix ifTrue:[ |
3011 | 2755 |
" |
2756 |
link it to a shared object with 'ld -shared' |
|
2757 |
" |
|
2758 |
needSharedObject := true. |
|
2759 |
ldArg := self linkSharedArgs ? '-shared'. |
|
182
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2760 |
]. |
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2761 |
|
2935 | 2762 |
osType = #'sys5_4' ifTrue:[ |
3011 | 2763 |
" |
2764 |
link it to a shared object with 'ld -G' |
|
2765 |
" |
|
2766 |
needSharedObject := true. |
|
2767 |
ldArg := self linkSharedArgs ? '-G'. |
|
182
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2768 |
]. |
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2769 |
|
2935 | 2770 |
osType = #solaris ifTrue:[ |
3011 | 2771 |
" |
2772 |
link it to a shared object with 'ld -G -B dynamic' |
|
2773 |
" |
|
2774 |
needSharedObject := true. |
|
2775 |
ldArg := self linkSharedArgs ? '-G -Bdynamic'. |
|
741 | 2776 |
]. |
2777 |
||
2935 | 2778 |
osType = #hpux ifTrue:[ |
3011 | 2779 |
" |
2780 |
link it to a shared object with 'ld -b -B immediate' |
|
2781 |
" |
|
2782 |
needSharedObject := true. |
|
2783 |
ldArg := self linkSharedArgs ? '-b -B immediate'. |
|
722
add7cabbd2bb
fixed shared-library loading for solaris.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
2784 |
]. |
add7cabbd2bb
fixed shared-library loading for solaris.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
2785 |
|
2935 | 2786 |
osType = #aix ifTrue:[ |
3011 | 2787 |
self activityNotification:'create export file'. |
2788 |
||
2789 |
"/ create an exports file. |
|
2790 |
expFileName := './' , baseFileName , '.exp'. |
|
2791 |
[ |
|
2792 |
expFile := expFileName asFilename writeStream. |
|
2793 |
expFile nextPutAll:'#!! ./' , baseFileName , (self sharedLibraryExtension). |
|
2794 |
expFile cr. |
|
2795 |
expFile nextPutAll:'_' , baseFileName , '_Init'. |
|
2796 |
expFile close. |
|
2797 |
] on:FileStream openErrorSignal do:[:ex| "do nothing"]. |
|
2798 |
||
2799 |
self activityNotification:'generating shared object'. |
|
2800 |
||
2801 |
" |
|
2802 |
link it to a shared object with 'cc -bI:...librun.exp -bE -bMSRE' |
|
2803 |
" |
|
2804 |
needSharedObject := true. |
|
2805 |
ld := 'cc'. |
|
2806 |
librunExpFileName := Smalltalk getSystemFileName:'lib/librun_aix.exp'. |
|
2807 |
librunExpFileName isNil ifTrue:[ |
|
2808 |
LastError := 'missing exports file: ''lib/librun_aix.exp'' - cannot link'. |
|
2809 |
^ nil |
|
2810 |
]. |
|
2811 |
||
2812 |
ldArg := '-bI:' , librunExpFileName , |
|
2813 |
' -bE:' , baseFileName , '.exp' , |
|
2814 |
' -bM:SRE -e _' , baseFileName , '_Init'. |
|
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2815 |
]. |
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
2816 |
|
2648
2d046cf8c90e
changed: #createLoadableObjectFor:
Stefan Vogel <sv@exept.de>
parents:
2627
diff
changeset
|
2817 |
oFileName := baseFileName , self objectFileExtension. |
182
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2818 |
needSharedObject ifTrue:[ |
3011 | 2819 |
self activityNotification:'generating shared object'. |
2820 |
||
2821 |
soFileName := baseFileName , self sharedLibraryExtension. |
|
2822 |
OperatingSystem removeFile:soFileName. |
|
2823 |
ld := ld , ' ' , ldArg , ' ', (ParserFlags linkArgs ? '') , |
|
2824 |
' -o ' , soFileName , ' ' , oFileName , ' ', |
|
2825 |
((ParserFlags searchedLibraries ? #()) asStringCollection asStringWith: $ ). |
|
2826 |
||
3172 | 2827 |
(Verbose or:[ STCCompilerInterface verbose ]) ifTrue:[ |
2828 |
Transcript showCR:('linking with: ',ld). |
|
3011 | 2829 |
]. |
2830 |
ok := OperatingSystem executeCommand:(ld , ' >errorOutput 2>&1'). |
|
2831 |
||
2832 |
ok ifFalse:[ |
|
2833 |
output := 'errorOutput' asFilename contentsOfEntireFile. |
|
2834 |
Transcript showCR:'linker error message:'. |
|
2835 |
Transcript showCR:output. |
|
2836 |
Transcript showCR:'linker command:'. |
|
2837 |
Transcript showCR:ld; endEntry. |
|
2838 |
]. |
|
2839 |
||
2840 |
OperatingSystem removeFile:oFileName. |
|
2841 |
expFileName notNil ifTrue:[ |
|
2842 |
OperatingSystem removeFile:expFileName |
|
2843 |
]. |
|
2844 |
^ soFileName. |
|
182
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2845 |
]. |
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2846 |
|
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2847 |
" |
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2848 |
assume we can load an ordinary binary |
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2849 |
" |
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2850 |
^ oFileName |
698 | 2851 |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
2852 |
"Modified: / 29-07-2004 / 17:29:44 / stefan" |
2932
d61b51867682
changed: #createLoadableObjectFor:
Claus Gittinger <cg@exept.de>
parents:
2931
diff
changeset
|
2853 |
"Modified: / 28-09-2012 / 18:00:13 / cg" |
182
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2854 |
! ! |
b8316f207380
added query for fileFormat; moved link-code from BCompiler to ObjFLoader
Claus Gittinger <cg@exept.de>
parents:
180
diff
changeset
|
2855 |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2856 |
!ObjectFileLoader class methodsFor:'lowlevel object loading'! |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2857 |
|
633 | 2858 |
initializeLoader |
2859 |
"initialize dynamic loader if required" |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
2860 |
|
633 | 2861 |
|stxName stxPathName| |
2862 |
||
2863 |
stxPathName := OperatingSystem pathOfSTXExecutable. |
|
2864 |
%{ |
|
2865 |
#ifdef GNU_DL |
|
2866 |
{ |
|
2867 |
static alreadyInitialized = 0; |
|
2868 |
extern dld_ignore_redefinitions; |
|
2869 |
||
2870 |
if (! alreadyInitialized) { |
|
2871 |
alreadyInitialized = 1; |
|
2872 |
||
2873 |
if (@global(Verbose) == true) { |
|
1975 | 2874 |
console_printf ("dld_init(%s)\n", __stringVal(stxPathName)); |
633 | 2875 |
} |
2876 |
/* |
|
2877 |
* dld requires the running executables name, |
|
2878 |
* to resolve symbols. |
|
2879 |
*/ |
|
2880 |
(void) dld_init (__stringVal(stxPathName)); |
|
2881 |
dld_ignore_redefinitions = 1; |
|
2882 |
} |
|
2883 |
} |
|
2884 |
#endif |
|
2885 |
%}. |
|
2886 |
! |
|
2887 |
||
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
2888 |
loadDynamicObject:pathNameOrFilename |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2889 |
"load an object-file (load/map into my address space). |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2890 |
Return a non-nil handle if ok, nil otherwise. |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
2891 |
No bindings or automatic initializations are done |
472 | 2892 |
- only a pure (low-level) load is performed. |
2893 |
For class-files or C-objects to be loaded with this method, |
|
2894 |
it is your responsibility to fetch any init-functions and |
|
2895 |
call them as appropriate. |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2896 |
This function is not supported on all architectures. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2897 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2898 |
|
2989 | 2899 |
|fn handle buffer pathName tempFile encodedPathName| |
2982 | 2900 |
|
2901 |
fn := pathNameOrFilename asFilename. |
|
2902 |
fn exists ifTrue:[ |
|
2993 | 2903 |
pathName := fn pathName. |
2904 |
self copyLibrariesWhenLoading ifTrue:[ |
|
2905 |
fn copyTo:(tempFile := ParserFlags stcModulePath asFilename construct:fn baseName). |
|
2906 |
pathName := tempFile pathName. |
|
2907 |
]. |
|
2746
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
2908 |
] ifFalse:[ |
2993 | 2909 |
"/ something like "kernel32.dll"; must be along the PATH setting |
2910 |
pathName := pathNameOrFilename asString. |
|
2746
9980d2b9b42c
fixes to load kernel32.dll under vc-compiled
Claus Gittinger <cg@exept.de>
parents:
2745
diff
changeset
|
2911 |
]. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2912 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2913 |
Verbose ifTrue:[ |
2993 | 2914 |
('loadDynamic: ',pathNameOrFilename asString,' (',pathName asString,')...') errorPrintCR |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2915 |
]. |
2989 | 2916 |
encodedPathName := OperatingSystem encodePath:pathName. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2917 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2918 |
"/ already loaded ? |
2989 | 2919 |
handle := self handleForDynamicObject:encodedPathName. |
1988
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
2920 |
handle notNil ifTrue:[ |
2993 | 2921 |
Verbose ifTrue:[ |
2922 |
('... ' , pathName , ' already loaded.') errorPrintCR. |
|
2923 |
]. |
|
2924 |
^ handle |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2925 |
]. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2926 |
|
759 | 2927 |
Verbose ifTrue:[ |
2993 | 2928 |
('initializeLoader...') errorPrintCR |
759 | 2929 |
]. |
589
ee0cc3ae769a
care for stx's path; req'd for dld if stx is not found in the current dir.
Claus Gittinger <cg@exept.de>
parents:
587
diff
changeset
|
2930 |
self initializeLoader. |
ee0cc3ae769a
care for stx's path; req'd for dld if stx is not found in the current dir.
Claus Gittinger <cg@exept.de>
parents:
587
diff
changeset
|
2931 |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2932 |
"/ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2933 |
"/ the 1st two entries are system dependent; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2934 |
"/ entry 3 is the pathName |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2935 |
"/ entry 4 is a unique ID |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2936 |
"/ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2937 |
buffer := Array new:4. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2938 |
buffer at:3 put:pathName. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2939 |
buffer at:4 put:NextHandleID. NextHandleID := NextHandleID + 1. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2940 |
|
759 | 2941 |
Verbose ifTrue:[ |
2993 | 2942 |
('primLoadDynamicObject...') errorPrintCR |
759 | 2943 |
]. |
2944 |
||
2989 | 2945 |
buffer := self primLoadDynamicObject:encodedPathName into:buffer. |
759 | 2946 |
Verbose ifTrue:[ |
2993 | 2947 |
('done') errorPrintCR |
759 | 2948 |
]. |
2949 |
||
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2950 |
buffer isNil ifTrue:[ |
2993 | 2951 |
LastError == #notImplemented ifTrue:[ |
2952 |
'ObjectFileLoader [warning]: no dynamic load facility present.' infoPrintCR. |
|
2953 |
] ifFalse:[ |
|
2954 |
LastError == #linkError ifTrue:[ |
|
2955 |
LinkErrorMessage notNil ifTrue:[ |
|
2956 |
('ObjectFileLoader [warning]: load error:' , LinkErrorMessage) infoPrintCR. |
|
2957 |
] ifFalse:[ |
|
2958 |
('ObjectFileLoader [warning]: load error') infoPrintCR. |
|
2959 |
]. |
|
2960 |
]. |
|
2961 |
]. |
|
2962 |
('ObjectFileLoader [warning]: failed to load: ' , pathName) infoPrintCR. |
|
2963 |
Transcript showCR:('ObjectFileLoader [warning]: failed to load: ' , pathName). |
|
2964 |
^ nil |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2965 |
]. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2966 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2967 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2968 |
remember loaded object for later unloading |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2969 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2970 |
handle := ObjectFileHandle new. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2971 |
handle sysHandle1:(buffer at:1). |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2972 |
handle sysHandle2:(buffer at:2). |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2973 |
handle pathName:(buffer at:3). |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2974 |
handle moduleID:(buffer at:4). |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2975 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2976 |
LoadedObjects isNil ifTrue:[ |
2993 | 2977 |
LoadedObjects := Dictionary new. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2978 |
]. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2979 |
LoadedObjects at:pathName put:handle. |
1904
71c41110a83a
flush cache when init function was called (not when the dll was loaded)
Michael Beyl <mb@exept.de>
parents:
1903
diff
changeset
|
2980 |
"/ Smalltalk flushCachedClasses. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2981 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2982 |
Verbose ifTrue:[ |
2993 | 2983 |
('loadDynamic ok; handle is: ' , handle printString) errorPrintCR. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2984 |
]. |
2767
12da7f27dcce
changed: #loadDynamicObject:
Claus Gittinger <cg@exept.de>
parents:
2746
diff
changeset
|
2985 |
"/ ObjectMemory garbageCollect. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2986 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2987 |
^ handle |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2988 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2989 |
"sys5.4: |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2990 |
|handle| |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2991 |
handle := ObjectFileLoader loadDynamicObject:'../stc/mod1.so'. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2992 |
ObjectFileLoader getFunction:'module1' from:handle |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2993 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2994 |
"next: |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2995 |
|handle| |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2996 |
handle := ObjectFileLoader loadDynamicObject:'../goodies/Path/AbstrPath.o'. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2997 |
ObjectFileLoader getFunction:'__AbstractPath_Init' from:handle |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2998 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
2999 |
"GLD: |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3000 |
|handle| |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3001 |
handle := ObjectFileLoader loadDynamicObject:'../clients/Tetris/Tetris.o'. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3002 |
ObjectFileLoader getFunction:'__TetrisBlock_Init' from:handle |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3003 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3004 |
|
2767
12da7f27dcce
changed: #loadDynamicObject:
Claus Gittinger <cg@exept.de>
parents:
2746
diff
changeset
|
3005 |
"Modified: / 06-12-2011 / 15:42:16 / cg" |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3006 |
! |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3007 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3008 |
loadModulesFromListOfUndefined:list |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3009 |
"try to figure out what has to be loaded to resolve symbols from list. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3010 |
return a list of handles of loaded objects |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3011 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3012 |
|inits classNames| |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3013 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3014 |
inits := list select:[:symbol | symbol notNil and:[symbol endsWith:'_Init']]. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3015 |
inits notNil ifTrue:[ |
634 | 3016 |
classNames := inits collect:[:symbol | |
3017 |
(symbol startsWith:'___') ifTrue:[ |
|
3018 |
symbol copyFrom:4 to:(symbol size - 5) |
|
3019 |
] ifFalse:[ |
|
3020 |
(symbol startsWith:'__') ifTrue:[ |
|
3021 |
symbol copyFrom:3 to:(symbol size - 5) |
|
3022 |
] ifFalse:[ |
|
3023 |
(symbol startsWith:'_') ifTrue:[ |
|
3024 |
symbol copyFrom:2 to:(symbol size - 5) |
|
3025 |
] ifFalse:[ |
|
3026 |
symbol |
|
3027 |
] |
|
3028 |
] |
|
3029 |
] |
|
3030 |
]. |
|
3031 |
" |
|
3032 |
autoload those classes |
|
3033 |
" |
|
3034 |
classNames do:[:aClassName | |
|
3035 |
|cls| |
|
3036 |
||
3037 |
(cls := Smalltalk classNamed:aClassName) notNil ifTrue:[ |
|
3038 |
'ObjectFileLoader [info]: autoloading ' infoPrint. aClassName infoPrintCR. |
|
3039 |
cls autoload |
|
3040 |
] |
|
3041 |
] |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3042 |
]. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3043 |
^ nil |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3044 |
|
477
5208c65a2b3d
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
3045 |
"Modified: 10.1.1997 / 17:58:23 / cg" |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3046 |
! |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3047 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3048 |
primLoadDynamicObject:pathName into:anInfoBuffer |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3049 |
"load an object-file (map into my address space). |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3050 |
Return an OS-handle (whatever that is) - where some space |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3051 |
(a 3-element array) has to be passed in for this. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3052 |
The first two entries are used in a machine dependent way, |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
3053 |
and callers may not depend on what is found there |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3054 |
(instead, only pass around handles transparently). |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3055 |
This function is not supported on all architectures." |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3056 |
|
1760
09a5b2b97f29
WindCVS: ----------------------------------------------------------------------
Stefan Vogel <sv@exept.de>
parents:
1759
diff
changeset
|
3057 |
%{ /* CALLSUNLIMITEDSTACK(noWIN32) */ |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3058 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3059 |
if (! __isArray(anInfoBuffer) |
646
02b5ea95f888
eliminated some single-underscore macro refs (stringSize, arraySize ...)
Claus Gittinger <cg@exept.de>
parents:
645
diff
changeset
|
3060 |
|| (__arraySize(anInfoBuffer) < 3)) { |
3001 | 3061 |
RETURN(nil); |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3062 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3063 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3064 |
#ifdef GNU_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3065 |
{ |
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3066 |
if (__isStringLike(pathName)) { |
3001 | 3067 |
if (dld_link(__stringVal(pathName))) { |
3068 |
if (@global(Verbose) == true) { |
|
3069 |
console_printf ("link file %s failed\n", __stringVal(pathName)); |
|
3070 |
} |
|
3071 |
if (@global(ErrorPrinting) == true) { |
|
3072 |
dld_perror("ObjectFileLoader - DLD error cant link"); |
|
3073 |
} |
|
3074 |
@global(LastError) = @symbol(linkError); |
|
3075 |
@global(LinkErrorMessage) = __MKSTRING("DLD error"); |
|
3076 |
RETURN ( nil ); |
|
3077 |
} |
|
3078 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = pathName; |
|
3079 |
__STORE(anInfoBuffer, pathName); |
|
3080 |
RETURN ( anInfoBuffer ); |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3081 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3082 |
RETURN ( nil ); |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3083 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3084 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3085 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3086 |
#ifdef WIN_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3087 |
{ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3088 |
HINSTANCE handle; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3089 |
int err; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3090 |
|
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3091 |
if (__isStringLike(pathName)) { |
3001 | 3092 |
if (@global(Verbose) == true) { |
3093 |
console_fprintf(stderr, "ObjectFileLoader [info]: loading dll: %s...\n", __stringVal(pathName)); |
|
3094 |
console_fflush(stderr); |
|
3095 |
} |
|
3096 |
// |
|
3097 |
// LOAD_WITH_ALTERED_SEARCH_PATH causes follow-up dlls to be looked up also |
|
3098 |
// in the directory of the loaded library, if an absolute path to |
|
3099 |
// the library has been provided. |
|
3100 |
// Note: this does not work for redirected library symbols, since they are |
|
3101 |
// resolved ad symbol lookup time and not at library load time |
|
3102 |
// |
|
3103 |
handle = LoadLibraryEx(__stringVal(pathName), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); |
|
3104 |
if (@global(Verbose) == true) { |
|
3105 |
console_fprintf(stderr, "ObjectFileLoader [info]: handle: %x\n", handle); |
|
3106 |
console_fflush(stderr); |
|
3107 |
} |
|
3108 |
if (handle == NULL) { |
|
3109 |
char *msg; |
|
3110 |
||
3111 |
err = GetLastError(); |
|
3112 |
if ((@global(ErrorPrinting) == true) |
|
3113 |
|| (@global(Verbose) == true)) { |
|
3114 |
console_fprintf (stderr, |
|
3115 |
"ObjectFileLoader [warning]: LoadLibrary %s failed; error: %x\n", |
|
3116 |
__stringVal(pathName), err); |
|
3117 |
} |
|
3118 |
@global(LastError) = @symbol(loadError);; |
|
3119 |
@global(LastErrorNumber) = __MKINT(__WIN32_ERR(err)); |
|
3120 |
switch (err) { |
|
3121 |
case ERROR_BAD_FORMAT: |
|
3122 |
msg = "LoadLibrary error - bad format"; |
|
3123 |
default: |
|
3124 |
msg = "LoadLibrary error"; |
|
3125 |
break; |
|
3126 |
} |
|
3127 |
@global(LinkErrorMessage) = __MKSTRING(msg); |
|
3128 |
RETURN ( nil ); |
|
3129 |
} |
|
3130 |
# if __POINTER_SIZE__ == 8 |
|
3131 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT( (INT)handle & 0xFFFFFFFF ); |
|
3132 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT( ((INT)handle >> 32) & 0xFFFFFFFF ); |
|
3133 |
# else |
|
3134 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT( (INT)handle & 0xFFFF ); |
|
3135 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT( ((INT)handle >> 16) & 0xFFFF ); |
|
3136 |
# endif |
|
3137 |
RETURN ( anInfoBuffer ); |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3138 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3139 |
RETURN ( nil ); |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3140 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3141 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3142 |
|
906 | 3143 |
#ifdef BEOS_DL |
3144 |
{ |
|
3145 |
void *handle; |
|
3146 |
int err; |
|
3147 |
||
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3148 |
if (__isStringLike(pathName)) { |
3001 | 3149 |
if (@global(Verbose) == true) { |
3150 |
console_fprintf(stderr, "ObjectFileLoader [info]: loading : %s...\n", __stringVal(pathName)); |
|
3151 |
console_fflush(stderr); |
|
3152 |
} |
|
3153 |
handle = load_add_on(__stringVal(pathName)); |
|
3154 |
if (@global(Verbose) == true) { |
|
3155 |
console_fprintf(stderr, "ObjectFileLoader [info]: handle: %x\n", handle); |
|
3156 |
console_fflush(stderr); |
|
3157 |
} |
|
3158 |
if (handle == NULL) { |
|
3159 |
char *msg; |
|
3160 |
||
3161 |
@global(LastError) = @symbol(linkError); |
|
3162 |
@global(LinkErrorMessage) = __MKSTRING("unknown error"); |
|
3163 |
RETURN ( nil ); |
|
3164 |
} |
|
3165 |
# if __POINTER_SIZE__ == 8 |
|
3166 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT( (INT)handle & 0xFFFFFFFF ); |
|
3167 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT( ((INT)handle >> 32) & 0xFFFFFFFF ); |
|
3168 |
# else |
|
3169 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT( (INT)handle & 0xFFFF ); |
|
3170 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT( ((INT)handle >> 16) & 0xFFFF ); |
|
3171 |
RETURN ( anInfoBuffer ); |
|
3172 |
# endif |
|
906 | 3173 |
} |
3174 |
RETURN ( nil ); |
|
3175 |
} |
|
3176 |
#endif |
|
3177 |
||
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3178 |
#ifdef DL1_6 |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3179 |
{ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3180 |
extern char *__myName__; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3181 |
char *ldname; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3182 |
OBJ tmpName; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3183 |
|
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3184 |
if (__isStringLike(pathName)) { |
3001 | 3185 |
if ( dl_loadmod_only(__myName__, __stringVal(pathName), &ldname) == 0 ) { |
3186 |
if (@global(Verbose) == true) { |
|
3187 |
console_printf ("link file %s failed\n", __stringVal(pathName)); |
|
3188 |
} |
|
3189 |
@global(LinkErrorMessage) = __MKSTRING("dl_load error"); |
|
3190 |
RETURN ( nil ); |
|
3191 |
} |
|
3192 |
/* |
|
3193 |
* returns the name of the temporary ld-file |
|
3194 |
* use that as handle ... |
|
3195 |
*/ |
|
3196 |
tmpName = __MKSTRING(ldname); |
|
3197 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = tmpName; |
|
3198 |
__STORE(anInfoBuffer, tmpName); |
|
3199 |
RETURN ( anInfoBuffer ); |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3200 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3201 |
RETURN ( nil ); |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3202 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3203 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3204 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3205 |
#ifdef AIX_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3206 |
{ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3207 |
char *objName, *libPath; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3208 |
int *handle; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3209 |
extern errno; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3210 |
|
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3211 |
if (__isStringLike(pathName)) { |
3001 | 3212 |
objName = __stringVal(pathName); |
3213 |
||
3214 |
if (__isStringLike(@global(LibPath))) { |
|
3215 |
libPath = __stringVal(@global(LibPath)); |
|
3216 |
} else { |
|
3217 |
libPath = (char *)0; |
|
3218 |
} |
|
3219 |
if ( (handle = (int *) load(objName, 0, libPath)) == 0 ) { |
|
3220 |
if (@global(Verbose) == true) { |
|
3221 |
char *messages[64]; |
|
3222 |
int i; |
|
3223 |
||
3224 |
console_fprintf (stderr, |
|
3225 |
"ObjectFileLoader [info]: load file %s failed errno=%d\n", |
|
3226 |
objName, errno); |
|
3227 |
||
3228 |
switch (errno) { |
|
3229 |
case ENOEXEC: |
|
3230 |
console_fprintf(stderr, " load messages:\n"); |
|
3231 |
loadquery(L_GETMESSAGES, messages, sizeof(messages)); |
|
3232 |
for (i=0; messages[i]; i++) { |
|
3233 |
console_fprintf(stderr, " %s\n", messages[i]); |
|
3234 |
} |
|
3235 |
break; |
|
3236 |
} |
|
3237 |
} else { |
|
3238 |
if (@global(ErrorPrinting) == true) { |
|
3239 |
console_fprintf (stderr, |
|
3240 |
"ObjectFileLoader [warning]: load file %s failed errno=%d\n", |
|
3241 |
objName, errno); |
|
3242 |
} |
|
3243 |
} |
|
3244 |
@global(LinkErrorMessage) = __MKSTRING("load error"); |
|
3245 |
RETURN ( nil ); |
|
3246 |
} |
|
3247 |
if (@global(Verbose) == true) { |
|
3248 |
console_fprintf(stderr, "ObjectFIleLoader [info]: load %s handle = %x\n", objName, handle); |
|
3249 |
} |
|
3250 |
||
3251 |
# if __POINTER_SIZE__ == 8 |
|
3252 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT( (INT)handle & 0xFFFFFFFF ); |
|
3253 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT( ((INT)handle >> 32) & 0xFFFFFFFF ); |
|
3254 |
# else |
|
3255 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT( (INT)handle & 0xFFFF ); |
|
3256 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT( ((INT)handle >> 16) & 0xFFFF ); |
|
3257 |
# endif |
|
3258 |
RETURN (anInfoBuffer); |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3259 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3260 |
RETURN ( nil ); |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3261 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3262 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3263 |
|
523 | 3264 |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3265 |
#ifdef SYSV4_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3266 |
{ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3267 |
void *handle; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3268 |
char *nm; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3269 |
char *errMsg; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3270 |
|
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3271 |
if ((pathName == nil) || __isStringLike(pathName)) { |
3001 | 3272 |
INT lowHandle, hiHandle; |
3273 |
||
3274 |
handle = (void *)dlopen(pathName == nil ? 0 : __stringVal(pathName), RTLD_NOW); |
|
3275 |
||
3276 |
if (! handle) { |
|
3277 |
errMsg = (char *) dlerror(); |
|
3278 |
if (@global(ErrorPrinting) == true) { |
|
3279 |
console_fprintf(stderr, "ObjectFileLoader [warning]: dlopen %s error:\n", __stringVal(pathName)); |
|
3280 |
console_fprintf(stderr, " <%s>\n", errMsg); |
|
3281 |
} |
|
3282 |
@global(LastError) = @symbol(linkError); |
|
3283 |
@global(LinkErrorMessage) = __MKSTRING(errMsg); |
|
3284 |
RETURN (nil); |
|
3285 |
} |
|
3286 |
||
3287 |
if (@global(Verbose) == true) { |
|
3288 |
console_fprintf(stderr, "ObjectFileLoader [info]: open %s handle = %"_lx_"\n", __stringVal(pathName), (INT)handle); |
|
3289 |
} |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3290 |
|
1607
074a99bb9a50
alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents:
1602
diff
changeset
|
3291 |
#if __POINTER_SIZE__ == 8 |
3001 | 3292 |
lowHandle = (INT)handle & 0xFFFFFFFFL; |
3293 |
hiHandle = ((INT)handle >> 32) & 0xFFFFFFFFL; |
|
701 | 3294 |
#else |
3001 | 3295 |
lowHandle = (INT)handle & 0xFFFF; |
3296 |
hiHandle = ((INT)handle >> 16) & 0xFFFF; |
|
701 | 3297 |
#endif |
3001 | 3298 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT(lowHandle); |
3299 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT(hiHandle); |
|
3300 |
RETURN (anInfoBuffer); |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3301 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3302 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3303 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3304 |
|
523 | 3305 |
|
3306 |
#ifdef HPUX10_DL |
|
3307 |
{ |
|
3308 |
void *handle; |
|
3309 |
char *nm; |
|
3310 |
char *errMsg; |
|
3311 |
||
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3312 |
if (__isStringLike(pathName)) { |
3001 | 3313 |
handle = (void *)shl_load(__stringVal(pathName), |
3314 |
BIND_IMMEDIATE, 0L /* address */); |
|
3315 |
||
3316 |
if (! handle) { |
|
3317 |
if (@global(ErrorPrinting) == true) { |
|
3318 |
console_fprintf(stderr, "shl_load %s error:\n", __stringVal(pathName)); |
|
3319 |
} |
|
3320 |
@global(LastError) = @symbol(linkError); |
|
3321 |
switch (errno) { |
|
3322 |
case ENOEXEC: |
|
3323 |
errMsg = "not a shared library"; |
|
3324 |
break; |
|
3325 |
case ENOSYM: |
|
3326 |
errMsg = "undefined symbols"; |
|
3327 |
break; |
|
3328 |
case ENOMEM: |
|
3329 |
errMsg = "out of memory"; |
|
3330 |
break; |
|
3331 |
case ENOENT: |
|
3332 |
errMsg = "non existing library"; |
|
3333 |
break; |
|
3334 |
case EACCES: |
|
3335 |
errMsg = "permission denied"; |
|
3336 |
break; |
|
3337 |
default: |
|
3338 |
errMsg = "unspecified error"; |
|
3339 |
break; |
|
3340 |
} |
|
3341 |
@global(LinkErrorMessage) = __MKSTRING(errMsg); |
|
3342 |
RETURN (nil); |
|
3343 |
} |
|
3344 |
||
3345 |
if (@global(Verbose) == true) { |
|
3346 |
console_printf("open %s handle = %"_lx_"\n", __stringVal(pathName), (INT)handle); |
|
3347 |
} |
|
3348 |
||
3349 |
# if __POINTER_SIZE__ == 8 |
|
3350 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT( (INT)handle & 0xFFFFFFFF ); |
|
3351 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT( ((INT)handle >> 32) & 0xFFFFFFFF ); |
|
3352 |
# else |
|
3353 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT( (INT)handle & 0xFFFF); |
|
3354 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT( ((INT)handle >> 16) & 0xFFFF ); |
|
3355 |
RETURN (anInfoBuffer); |
|
3356 |
# endif |
|
523 | 3357 |
} |
3358 |
} |
|
3359 |
#endif |
|
3360 |
||
3361 |
||
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3362 |
#ifdef SUN_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3363 |
{ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3364 |
void *handle; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3365 |
|
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3366 |
if ((pathName == nil) || __isStringLike(pathName)) { |
3001 | 3367 |
if (pathName == nil) |
3368 |
handle = dlopen((char *)0, 1); |
|
3369 |
else |
|
3370 |
handle = dlopen(__stringVal(pathName), 1); |
|
3371 |
||
3372 |
if (! handle) { |
|
3373 |
if (@global(ErrorPrinting) == true) { |
|
3374 |
console_fprintf(stderr, "dlopen %s error: <%s>\n", |
|
3375 |
__stringVal(pathName), dlerror()); |
|
3376 |
} |
|
3377 |
@global(LastError) = @symbol(linkError); |
|
3378 |
@global(LinkErrorMessage) = __MKSTRING("dlopen error"); |
|
3379 |
RETURN (nil); |
|
3380 |
} |
|
3381 |
||
3382 |
if (@global(Verbose) == true) { |
|
3383 |
console_printf("open %s handle = %"_lx_"\n", __stringVal(pathName), (INT)handle); |
|
3384 |
} |
|
3385 |
||
3386 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = __MKSMALLINT( (int)handle & 0xFFFF ); |
|
3387 |
__ArrayInstPtr(anInfoBuffer)->a_element[1] = __MKSMALLINT( ((int)handle >> 16) & 0xFFFF ); |
|
3388 |
RETURN (anInfoBuffer); |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3389 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3390 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3391 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3392 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3393 |
#ifdef NEXT_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3394 |
{ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3395 |
long result; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3396 |
char *files[2]; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3397 |
NXStream *errOut; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3398 |
|
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3399 |
if (__isStringLike(pathName)) { |
3001 | 3400 |
files[0] = (char *) __stringVal(pathName); |
3401 |
files[1] = (char *) 0; |
|
3402 |
errOut = NXOpenFile(2, 2); |
|
3403 |
result = rld_load(errOut, |
|
3404 |
(struct mach_header **)0, |
|
3405 |
files, |
|
3406 |
(char *)0); |
|
3407 |
NXClose(errOut); |
|
3408 |
if (! result) { |
|
3409 |
@global(LinkErrorMessage) = __MKSTRING("rld_load error"); |
|
3410 |
@global(LastError) = @symbol(linkError); |
|
3411 |
if (@global(ErrorPrinting) == true) { |
|
3412 |
console_fprintf(stderr, "rld_load %s failed\n", __stringVal(pathName)); |
|
3413 |
} |
|
3414 |
RETURN (nil); |
|
3415 |
} |
|
3416 |
||
3417 |
if (@global(Verbose) == true) |
|
3418 |
console_printf("rld_load %s ok\n", __stringVal(pathName)); |
|
3419 |
||
3420 |
__ArrayInstPtr(anInfoBuffer)->a_element[0] = pathName; |
|
3421 |
__STORE(anInfoBuffer, pathName); |
|
3422 |
RETURN ( anInfoBuffer ); |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3423 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3424 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3425 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3426 |
%}. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3427 |
LastError := #notImplemented. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3428 |
^ nil |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3429 |
! |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3430 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3431 |
primUnloadDynamicObject:aHandle |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3432 |
"unload an object-file (unmap from my address space). |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3433 |
This is a low-level entry, which does not care if there are |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3434 |
still any code references (from blocks or methods) to this |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3435 |
module. Calling it for still living classes will definitely |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3436 |
lead to some fatal conditions to occur later." |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3437 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3438 |
|sysHandle1 sysHandle2| |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3439 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3440 |
sysHandle1 := aHandle sysHandle1. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3441 |
sysHandle2 := aHandle sysHandle2. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3442 |
|
1760
09a5b2b97f29
WindCVS: ----------------------------------------------------------------------
Stefan Vogel <sv@exept.de>
parents:
1759
diff
changeset
|
3443 |
%{ /* CALLSUNLIMITEDSTACK(noWIN32) */ |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3444 |
#ifdef GNU_DL |
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
3445 |
if (__isStringLike(sysHandle1)) { |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3446 |
if (dld_unlink_by_file(__stringVal(sysHandle1), 1)) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3447 |
if (@global(Verbose) == true) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3448 |
console_printf ("unlink file %s failed\n", __stringVal(sysHandle1)); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3449 |
dld_perror("cant unlink"); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3450 |
} |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3451 |
RETURN (false); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3452 |
} |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3453 |
RETURN (true); |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3454 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3455 |
RETURN (false); |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3456 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3457 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3458 |
#ifdef WIN_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3459 |
int val; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3460 |
HINSTANCE handle; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3461 |
int err; |
771 | 3462 |
jmp_buf exitJmpBuf; |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3463 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3464 |
if (__bothSmallInteger(sysHandle1, sysHandle2)) { |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3465 |
val = (_intVal(sysHandle2) << 16) + _intVal(sysHandle1); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3466 |
handle = (HINSTANCE)(val); |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3467 |
|
771 | 3468 |
if (setjmp(exitJmpBuf)) { |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3469 |
__setAtExitLongJmp(exitJmpBuf); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3470 |
if (FreeLibrary(handle) != TRUE) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3471 |
__setAtExitLongJmp(0); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3472 |
err = GetLastError(); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3473 |
if (@global(Verbose) == true) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3474 |
console_fprintf (stderr, |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3475 |
"ObjectFileLoader [warning]: FreeLibrary %s failed; error: %x\n", |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3476 |
__stringVal(sysHandle1), err); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3477 |
} |
2923
10853691e2f2
oops - missing MKINT (may lead to crash in GC after unloading objects)
Claus Gittinger <cg@exept.de>
parents:
2920
diff
changeset
|
3478 |
@global(LastErrorNumber) = __MKINT(__WIN32_ERR(err)); |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3479 |
RETURN (false); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3480 |
} |
771 | 3481 |
} else { |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3482 |
__setAtExitLongJmp(0); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3483 |
console_fprintf(stderr, "ObjectFileLoader [warning]: FreeLibrary called exit() - ignored\n"); |
771 | 3484 |
} |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3485 |
RETURN (true); |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3486 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3487 |
RETURN (false); |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3488 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3489 |
|
906 | 3490 |
#ifdef BEOS_DL |
3491 |
int val; |
|
3492 |
void *handle; |
|
3493 |
int ok, err; |
|
3494 |
jmp_buf exitJmpBuf; |
|
3495 |
||
3496 |
if (__bothSmallInteger(sysHandle1, sysHandle2)) { |
|
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3497 |
val = (_intVal(sysHandle2) << 16) + _intVal(sysHandle1); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3498 |
handle = (HINSTANCE)(val); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3499 |
|
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3500 |
if (setjmp(exitJmpBuf)) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3501 |
__setAtExitLongJmp(exitJmpBuf); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3502 |
ok = unload_add_on((image_id) handle); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3503 |
__setAtExitLongJmp(0); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3504 |
if (ok != 0) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3505 |
@global(LastErrorNumber) = __MKSMALLINT(ok); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3506 |
RETURN (false); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3507 |
} |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3508 |
} else { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3509 |
__setAtExitLongJmp(0); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3510 |
console_fprintf(stderr, "ObjectFileLoader [warning]: FreeLibrary called exit() - ignored\n"); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3511 |
} |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3512 |
RETURN (true); |
906 | 3513 |
} |
3514 |
RETURN (false); |
|
3515 |
#endif |
|
3516 |
||
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3517 |
#ifdef SYSV4_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3518 |
{ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3519 |
void *h; |
701 | 3520 |
INT val; |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3521 |
OBJ low = sysHandle1, hi = sysHandle2; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3522 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3523 |
if (__bothSmallInteger(low, hi)) { |
1607
074a99bb9a50
alpha64 vs. POINTER_SIZE cleanup
Claus Gittinger <cg@exept.de>
parents:
1602
diff
changeset
|
3524 |
#if __POINTER_SIZE__ == 8 |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3525 |
val = (__intVal(hi) << 32) + __intVal(low); |
701 | 3526 |
#else |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3527 |
val = (_intVal(hi) << 16) + _intVal(low); |
701 | 3528 |
#endif |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3529 |
h = (void *)(val); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3530 |
if (@global(Verbose) == true) |
2998 | 3531 |
console_printf("close handle = %"_lx_"\n", (INT)h); |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3532 |
if (dlclose(h) != 0) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3533 |
console_fprintf(stderr, "dlclose failed with:<%s>\n", dlerror()); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3534 |
RETURN (false); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3535 |
} |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3536 |
RETURN (true); |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3537 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3538 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3539 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3540 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3541 |
#ifdef SUN_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3542 |
{ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3543 |
void *h; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3544 |
int val; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3545 |
OBJ low = sysHandle1, hi = sysHandle2; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3546 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3547 |
if (__bothSmallInteger(low, hi)) { |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3548 |
val = (_intVal(hi) << 16) + _intVal(low); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3549 |
h = (void *)(val); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3550 |
if (@global(Verbose) == true) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3551 |
console_printf("close handle = %x\n", h); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3552 |
} |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3553 |
dlclose(h); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3554 |
RETURN (true); |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3555 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3556 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3557 |
#endif |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3558 |
|
523 | 3559 |
#ifdef HPUX10_DL |
3560 |
{ |
|
3561 |
int *h; |
|
3562 |
int val; |
|
3563 |
OBJ low = sysHandle1, hi = sysHandle2; |
|
3564 |
||
3565 |
if (__bothSmallInteger(low, hi)) { |
|
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3566 |
val = (_intVal(hi) << 16) + _intVal(low); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3567 |
h = (void *)(val); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3568 |
if (@global(Verbose) == true) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3569 |
console_printf("unload handle = %x\n", h); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3570 |
} |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3571 |
shl_unload(h); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3572 |
RETURN (true); |
523 | 3573 |
} |
3574 |
} |
|
3575 |
#endif |
|
3576 |
||
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3577 |
#ifdef AIX_DL |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3578 |
{ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3579 |
int *h; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3580 |
int val; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3581 |
OBJ low = sysHandle1, hi = sysHandle2; |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3582 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3583 |
if (__bothSmallInteger(low, hi)) { |
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3584 |
val = (_intVal(hi) << 16) + _intVal(low); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3585 |
h = (int *)(val); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3586 |
if (@global(Verbose) == true) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3587 |
console_printf("unload handle = %x\n", h); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3588 |
} |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3589 |
if ( unload(h) != 0) { |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3590 |
console_fprintf(stderr, "unload failed\n"); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3591 |
RETURN (false); |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3592 |
} |
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3593 |
RETURN (true); |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3594 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3595 |
} |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3596 |
#endif |
529
039322479f26
NeXTStep cannot unload; send a warning to stderr
Claus Gittinger <cg@exept.de>
parents:
525
diff
changeset
|
3597 |
|
039322479f26
NeXTStep cannot unload; send a warning to stderr
Claus Gittinger <cg@exept.de>
parents:
525
diff
changeset
|
3598 |
#ifdef NEXT_DL |
039322479f26
NeXTStep cannot unload; send a warning to stderr
Claus Gittinger <cg@exept.de>
parents:
525
diff
changeset
|
3599 |
{ |
1975 | 3600 |
console_fprintf(stderr, "ObjectFileLoader [warning]: Sorry, NeXTStep does not support selective unloading\n"); |
529
039322479f26
NeXTStep cannot unload; send a warning to stderr
Claus Gittinger <cg@exept.de>
parents:
525
diff
changeset
|
3601 |
} |
039322479f26
NeXTStep cannot unload; send a warning to stderr
Claus Gittinger <cg@exept.de>
parents:
525
diff
changeset
|
3602 |
#endif |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3603 |
%}. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3604 |
^ false |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3605 |
! |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3606 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3607 |
unloadDynamicObject:handle |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3608 |
"close an object-file (unmap from my address space) |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3609 |
and remove the entry from the remembered object file set. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3610 |
This is a low-level entry, which does not care if there are |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3611 |
still any code references (from blocks or methods) to this |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3612 |
module. Calling it for still living classes will definitely |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3613 |
lead to some fatal conditions to occur later." |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3614 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3615 |
|key fileName functionName deInitAddr m| |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3616 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3617 |
Verbose ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3618 |
'unload module name=' errorPrint. handle pathName errorPrintCR. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3619 |
]. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3620 |
|
966
0da15d671aef
proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3621 |
handle isUnknownHandle ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3622 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3623 |
'module type is not known - assume uninitialized classLib' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3624 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3625 |
self unregisterModule:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3626 |
handle makeClassLibHandle. |
966
0da15d671aef
proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3627 |
] ifFalse:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3628 |
handle isClassLibHandle ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3629 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3630 |
'a classLib - deinit classes' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3631 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3632 |
self deinitializeClassesFromModule:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3633 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3634 |
'unregister' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3635 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3636 |
self unregisterModule:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3637 |
] ifFalse:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3638 |
handle isMethodHandle ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3639 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3640 |
'a methodHandle - unregister' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3641 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3642 |
self unregisterModule:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3643 |
] ifFalse:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3644 |
handle isFunctionObjectHandle ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3645 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3646 |
'a functionObject - fixup functionRefs' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3647 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3648 |
handle functions do:[:f | |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3649 |
f notNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3650 |
f invalidate |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3651 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3652 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3653 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3654 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3655 |
"/ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3656 |
"/ call its deInit function (if present) |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3657 |
"/ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3658 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3659 |
'search for deInit function...' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3660 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3661 |
fileName := handle pathName asFilename baseName. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3662 |
functionName := self initFunctionBasenameForFile:fileName. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3663 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3664 |
deInitAddr := self findFunction:functionName suffix:'__deInit' in:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3665 |
deInitAddr notNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3666 |
Verbose ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3667 |
'invoke deInit function...' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3668 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3669 |
self |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3670 |
saveCallInitFunctionAt:deInitAddr |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3671 |
in:fileName |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3672 |
specialInit:false |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3673 |
forceOld:true |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3674 |
interruptable:false |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3675 |
argument:0 |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3676 |
identifyAs:handle |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3677 |
returnsObject:false. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3678 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3679 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3680 |
]. |
966
0da15d671aef
proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3681 |
]. |
0da15d671aef
proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3682 |
|
0da15d671aef
proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3683 |
Verbose ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3684 |
'cleanup done - now unload...' errorPrintCR. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3685 |
]. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3686 |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3687 |
^ self. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3688 |
"/ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3689 |
"/ now, really unload |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3690 |
"/ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3691 |
(self primUnloadDynamicObject:handle) ifFalse:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3692 |
^ self error:'unloadDynamic failed' mayProceed:true |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3693 |
]. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3694 |
|
966
0da15d671aef
proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3695 |
Verbose ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3696 |
'unload done ...' errorPrintCR. |
966
0da15d671aef
proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3697 |
]. |
0da15d671aef
proper unregistration, when a classLib fails to load
Claus Gittinger <cg@exept.de>
parents:
962
diff
changeset
|
3698 |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3699 |
"/ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3700 |
"/ remove from loaded objects |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3701 |
"/ |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3702 |
LoadedObjects notNil ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3703 |
key := LoadedObjects keyAtEqualValue:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3704 |
key notNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3705 |
LoadedObjects removeKey:key |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3706 |
] |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3707 |
]. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3708 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3709 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3710 |
for individual methods, we keep the methodObject, |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3711 |
but make it unexecutable. Its still visible in the browser. |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3712 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3713 |
handle isMethodHandle ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3714 |
((m := handle method) notNil |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3715 |
and:[m ~~ 0]) ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3716 |
m makeUnloaded. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3717 |
] |
791
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3718 |
]. |
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3719 |
|
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3720 |
handle isClassLibHandle ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3721 |
Smalltalk flushCachedClasses. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3722 |
Class flushSubclassInfo. |
791
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3723 |
]. |
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3724 |
handle isMethodHandle ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3725 |
ObjectMemory flushCaches. |
791
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3726 |
]. |
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3727 |
|
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3728 |
handle moduleID:nil. |
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3729 |
handle sysHandle1:nil. |
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3730 |
handle sysHandle2:nil. |
655e20eb35d7
flush moduleID and sysHandle when unloading a dynamic object.
Claus Gittinger <cg@exept.de>
parents:
790
diff
changeset
|
3731 |
|
2459 | 3732 |
"Modified: / 15-11-2010 / 13:20:20 / cg" |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3733 |
! ! |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3734 |
|
369 | 3735 |
!ObjectFileLoader class methodsFor:'queries'! |
141 | 3736 |
|
3737 |
canLoadObjectFiles |
|
259 | 3738 |
"return true, if dynamic loading is possible. |
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3739 |
Currently, only ELF based systems, AIX and linux a.out can do this." |
141 | 3740 |
|
3741 |
self primCanLoadObjectFiles ifTrue:[^true]. |
|
3742 |
||
3743 |
"/ can add a return true here, if I ever get manual loading to work |
|
3744 |
"/ for some specific machine |
|
3745 |
^ false |
|
259 | 3746 |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3747 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3748 |
ObjectFileLoader canLoadObjectFiles |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3749 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3750 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3751 |
"Modified: 8.1.1997 / 18:13:01 / cg" |
141 | 3752 |
! |
3753 |
||
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
3754 |
handleForDynamicObject:pathNameOrFilename |
1988
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3755 |
"answer the handle of pathName (or nil if it has not been loaded)" |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3756 |
|
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
3757 |
|pathName| |
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
3758 |
|
1988
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3759 |
LoadedObjects isNil ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3760 |
^ nil. |
1988
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3761 |
]. |
2407
8fb1437d983a
Use #libPath for Unix and Windows
Stefan Vogel <sv@exept.de>
parents:
2405
diff
changeset
|
3762 |
pathName := pathNameOrFilename asFilename pathName. |
1988
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3763 |
^ LoadedObjects at:pathName ifAbsent:nil. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3764 |
! |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3765 |
|
2393 | 3766 |
handleFromID:id |
3767 |
"given an id, return the pathName, or nil for static modules" |
|
3768 |
||
3769 |
LoadedObjects notNil ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3770 |
LoadedObjects keysAndValuesDo:[:name :handle | |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3771 |
handle moduleID == id ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3772 |
^ handle |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3773 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
3774 |
]. |
2393 | 3775 |
]. |
3776 |
^ nil |
|
3777 |
||
3778 |
" |
|
3779 |
ObjectFileLoader handleFromID:1 |
|
3780 |
" |
|
3781 |
||
3782 |
"Modified: 28.8.1995 / 18:08:28 / claus" |
|
3783 |
! |
|
3784 |
||
141 | 3785 |
loadedObjectFiles |
3786 |
"return a collection containing the names of all |
|
3787 |
dynamically loaded objects." |
|
3788 |
||
3789 |
LoadedObjects isNil ifTrue:[^ #()]. |
|
3790 |
^ LoadedObjects keys copy |
|
3791 |
||
3792 |
" |
|
3793 |
ObjectFileLoader loadedObjectFiles |
|
3794 |
" |
|
3795 |
! |
|
3796 |
||
3797 |
loadedObjectHandles |
|
3798 |
"return a collection of all handles" |
|
3799 |
||
3800 |
LoadedObjects isNil ifTrue:[^ #()]. |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
3801 |
^ LoadedObjects |
141 | 3802 |
|
3803 |
" |
|
3804 |
ObjectFileLoader loadedObjectHandles |
|
3805 |
" |
|
3806 |
||
3807 |
"Created: 17.9.1995 / 14:28:55 / claus" |
|
3808 |
"Modified: 17.9.1995 / 16:13:48 / claus" |
|
3809 |
! |
|
3810 |
||
3811 |
loadedObjectHandlesDo:aBlock |
|
3812 |
"enumerate all handles" |
|
3813 |
||
3814 |
LoadedObjects notNil ifTrue:[ |
|
3815 |
LoadedObjects copy do:aBlock. |
|
3816 |
]. |
|
3817 |
||
3818 |
" |
|
3819 |
ObjectFileLoader loadedObjectHandlesDo:[:h | h pathName printNL] |
|
3820 |
" |
|
3821 |
||
3822 |
"Created: 14.9.1995 / 22:03:13 / claus" |
|
3823 |
"Modified: 14.9.1995 / 22:32:48 / claus" |
|
3824 |
! |
|
3825 |
||
1602 | 3826 |
moduleNamed:aNameString |
3827 |
"return the module named aNameString" |
|
3828 |
||
3829 |
|moduleDescriptor| |
|
3830 |
||
1906 | 3831 |
moduleDescriptor := |
3832 |
ObjectMemory binaryModuleInfo |
|
3833 |
detect:[:eachModuleDescriptor | eachModuleDescriptor libraryName = aNameString] |
|
3834 |
ifNone:[^ nil]. |
|
1742 | 3835 |
|
3836 |
^ LoadedObjects at:(moduleDescriptor pathName) ifAbsent:[]. |
|
1602 | 3837 |
|
3838 |
" |
|
3839 |
ObjectFileLoader moduleNamed:'ctypes' |
|
3840 |
" |
|
3841 |
! |
|
3842 |
||
141 | 3843 |
pathNameFromID:id |
3844 |
"given an id, return the pathName, or nil for static modules" |
|
3845 |
||
3846 |
LoadedObjects notNil ifTrue:[ |
|
3847 |
LoadedObjects keysAndValuesDo:[:name :handle | |
|
3848 |
handle moduleID == id ifTrue:[ |
|
3849 |
^ handle pathName |
|
3850 |
] |
|
3851 |
]. |
|
3852 |
]. |
|
3853 |
^ nil |
|
3854 |
||
3855 |
" |
|
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
3856 |
ObjectFileLoader pathNameFromID:1 |
141 | 3857 |
" |
3858 |
||
3859 |
"Modified: 28.8.1995 / 18:08:28 / claus" |
|
3860 |
! |
|
3861 |
||
3862 |
primCanLoadObjectFiles |
|
3863 |
"return true, if loading is possible using a standard mechanism" |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3864 |
|
141 | 3865 |
%{ /* NOCONTEXT */ |
3866 |
#ifdef HAS_DL |
|
3867 |
# if !defined(OS_DEFINE) || defined(unknownOS) |
|
1975 | 3868 |
console_fprintf(stderr, "*** OS_DEFINE not correct\n"); |
141 | 3869 |
# else |
3870 |
# if !defined(CPU_DEFINE) || defined(unknownCPU) |
|
1975 | 3871 |
console_fprintf(stderr, "*** CPU_DEFINE not correct\n"); |
141 | 3872 |
# else |
3873 |
RETURN (true); |
|
3874 |
# endif |
|
3875 |
# endif |
|
3876 |
#endif |
|
3877 |
%}. |
|
3878 |
^ false |
|
470
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3879 |
|
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3880 |
" |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3881 |
ObjectFileLoader primCanLoadObjectFiles |
2994a91156e0
category changes; added comments.
Claus Gittinger <cg@exept.de>
parents:
469
diff
changeset
|
3882 |
" |
20 | 3883 |
! ! |
3884 |
||
369 | 3885 |
!ObjectFileLoader class methodsFor:'st object file handling'! |
303 | 3886 |
|
3887 |
callInitFunctionAt:address specialInit:special forceOld:forceOld interruptable:interruptable argument:argument identifyAs:handle returnsObject:returnsObject |
|
3888 |
"call a function at address - a very dangerous operation. |
|
3889 |
This is needed to call the classes init-function after loading in a |
|
3890 |
class-object file or to call the CTORS when c++ modules are loaded. |
|
3891 |
ForceOld (if true) will have the memory manager |
|
3892 |
allocate things in oldSpace instead of newSpace. |
|
3893 |
If special is true, this is a smalltalk moduleInit (i.e. pass the vm-entries table); |
|
3894 |
otherwise, its called without arguments. |
|
3895 |
If its a smalltalk-moduleInit, it may be either for a classPackage (which should |
|
3896 |
install all of its classes) or for a single incrementally compiled methdod |
|
3897 |
(it should then NOT install it, but return the method object instead). |
|
3898 |
||
3899 |
DANGER: Internal & highly specialized. Dont use in your programs. |
|
1906 | 3900 |
This interface may change without notice." |
1018
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3901 |
|
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3902 |
|moduleID retVal oldSpaceReserve| |
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
3903 |
|
303 | 3904 |
handle notNil ifTrue:[ |
1906 | 3905 |
moduleID := handle moduleID |
303 | 3906 |
]. |
1018
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3907 |
"/ |
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3908 |
"/ for various reasons, classes, methods, literals, methodDicts etc. |
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3909 |
"/ must be allocated in oldSpace when coming from a compiled |
1759
a49b7066594c
UNLIMITEDSTACK for windows, too
Stefan Vogel <sv@exept.de>
parents:
1745
diff
changeset
|
3910 |
"/ classLibrary, and no compressing garbage collect is allowed during |
1018
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3911 |
"/ the creation of those. |
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3912 |
"/ Therefore, we must ensure, that enough oldSpace reserve is available ... |
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3913 |
"/ (how much is enough ?) |
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3914 |
"/ |
011f0c9fa19d
more oldSpace reserve (also a classVar to allow for dynamic change)
Claus Gittinger <cg@exept.de>
parents:
1014
diff
changeset
|
3915 |
oldSpaceReserve := OldSpaceReserve ? (1024*1024). |
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
3916 |
|
1033
f5bad5027056
More Stack when calling init function.
Stefan Vogel <sv@exept.de>
parents:
1024
diff
changeset
|
3917 |
%{ /* CALLSSTACK: 128000 */ |
303 | 3918 |
OBJ (*addr)(); |
3919 |
int prevSpace, force; |
|
591 | 3920 |
INT arg = 0, ret = 0; |
303 | 3921 |
int wasBlocked = 1; |
3922 |
||
320
54bfd6fd28b9
removed old obsolete manual loader; aix fixes
Claus Gittinger <cg@exept.de>
parents:
317
diff
changeset
|
3923 |
if (__isInteger(address)) { |
1906 | 3924 |
if (_isSmallInteger(argument)) { |
3925 |
arg = __intVal(argument); |
|
3926 |
||
3927 |
addr = (OBJFUNC)(__longIntVal(address)); |
|
3928 |
||
3929 |
/* |
|
3930 |
* allow function to be interrupted |
|
3931 |
*/ |
|
3932 |
if (interruptable != true) { |
|
3933 |
wasBlocked = (__BLOCKINTERRUPTS() == true); |
|
3934 |
} |
|
3935 |
||
3936 |
force = (forceOld == true); |
|
3937 |
if (force) { |
|
3938 |
int reserve = __intVal(oldSpaceReserve); |
|
3939 |
if ((__oldSpaceSize() - __oldSpaceUsed()) < reserve) { |
|
3940 |
__moreOldSpace(__thisContext, reserve); |
|
3941 |
} |
|
3942 |
prevSpace = __allocForceSpace(OLDSPACE); |
|
3943 |
} |
|
3944 |
||
3945 |
if (@global(Verbose) == true) { |
|
2339
e08285b13360
Eliminate _USE_L_MODIFIER_IN_PRINTF
Stefan Vogel <sv@exept.de>
parents:
2334
diff
changeset
|
3946 |
console_printf("calling initfunc %lx(%lx) ...\n", (long)addr, (long)arg); |
1906 | 3947 |
} |
3948 |
||
3949 |
if (special == true) { |
|
3950 |
if (__isSmallInteger(moduleID)) { |
|
3951 |
__SET_MODULE_ID(__intVal(moduleID)); |
|
3952 |
} |
|
3953 |
retVal = (*addr)(arg, __pRT__); |
|
3954 |
__SET_MODULE_ID(0); |
|
3955 |
if (returnsObject != true) { |
|
3956 |
retVal = nil; |
|
3957 |
} |
|
3958 |
} else { |
|
3959 |
if (returnsObject == true) { |
|
3960 |
retVal = (*addr)(arg); |
|
3961 |
} else { |
|
3962 |
ret = (INT) ((*addr)(arg)); |
|
3963 |
retVal = __mkSmallInteger(ret); |
|
3964 |
} |
|
3965 |
} |
|
3966 |
||
3967 |
if (force) { |
|
3968 |
__allocForceSpace(prevSpace); |
|
3969 |
} |
|
3970 |
||
3971 |
if (! wasBlocked) { |
|
3972 |
__UNBLOCKINTERRUPTS(); |
|
3973 |
} |
|
3974 |
RETURN (retVal); |
|
3975 |
} |
|
303 | 3976 |
} |
3977 |
%}. |
|
3978 |
self primitiveFailed |
|
3979 |
! |
|
3980 |
||
1988
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3981 |
classPresentCheck:aClassOrClassName |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3982 |
"callBack from class registration code in VM: |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3983 |
make certain, that aClassOrClassName is loaded too ... |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3984 |
(req'd if a subclass of an autoloaded class has been loaded). |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3985 |
This is now invoked both for superClasses AND preRequisite classnames (for extensions)" |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3986 |
|
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3987 |
|className class| |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3988 |
|
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3989 |
aClassOrClassName isBehavior ifTrue:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3990 |
class := aClassOrClassName. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3991 |
className := aClassOrClassName name. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3992 |
] ifFalse:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3993 |
aClassOrClassName isString ifTrue:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3994 |
className := aClassOrClassName. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3995 |
class := Smalltalk classNamed:aClassOrClassName. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3996 |
] ifFalse:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3997 |
'ObjectFileLoader [warning]: check failed - no behavior' errorPrintCR. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3998 |
^ false |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
3999 |
] |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4000 |
]. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4001 |
|
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4002 |
class isNil ifTrue:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4003 |
Verbose ifTrue:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4004 |
('ObjectFileLoader [info]: missing class: ' , className) errorPrintCR. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4005 |
]. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4006 |
"/ how can I find this missing class - need some package info |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4007 |
^ false. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4008 |
]. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4009 |
|
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4010 |
class notNil ifTrue:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4011 |
Verbose ifTrue:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4012 |
('ObjectFileLoader [info]: check for ' , className , ' being loaded') errorPrintCR. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4013 |
]. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4014 |
|
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4015 |
class autoload. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4016 |
(class isBehavior and:[class isLoaded]) ifTrue:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4017 |
Verbose ifTrue:[ |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4018 |
('ObjectFileLoader [info]: ok, loaded. continue registration of actual class') errorPrintCR. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4019 |
]. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4020 |
class signature. "/ req'd in VM for validation |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4021 |
^ true |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4022 |
]. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4023 |
]. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4024 |
|
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4025 |
('ObjectFileLoader [warning]: superclass not loaded; registration of ' , className , ' fails') errorPrintCR. |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4026 |
^ false |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4027 |
|
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4028 |
"Modified: 10.1.1997 / 17:58:48 / cg" |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4029 |
! |
6d075e94c774
Do not initialize an object file, if it has already been loaded&initialized before
Stefan Vogel <sv@exept.de>
parents:
1975
diff
changeset
|
4030 |
|
303 | 4031 |
deinitializeClassesFromModule:handle |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
4032 |
"send #deinitialize and an #aboutToUnload notification |
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
4033 |
to all classes of a module." |
303 | 4034 |
|
4035 |
|classes| |
|
4036 |
||
4037 |
classes := handle classes. |
|
4038 |
classes notNil ifTrue:[ |
|
634 | 4039 |
classes do:[:aClass | |
4040 |
aClass notNil ifTrue:[ |
|
4041 |
aClass isMeta ifFalse:[ |
|
4042 |
Verbose ifTrue:[ |
|
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4043 |
'send #deinitialize to:' errorPrint. aClass name errorPrintCR. |
634 | 4044 |
]. |
4045 |
aClass deinitialize. |
|
4046 |
aClass update:#aboutToUnload with:nil from:self |
|
4047 |
] |
|
4048 |
] |
|
4049 |
] |
|
303 | 4050 |
] |
307
2552fd5e8592
give cModule a chance to signal failure (return -1 from __Init);
Claus Gittinger <cg@exept.de>
parents:
306
diff
changeset
|
4051 |
|
477
5208c65a2b3d
newStyle info & error messages
Claus Gittinger <cg@exept.de>
parents:
474
diff
changeset
|
4052 |
"Modified: 10.1.1997 / 17:56:50 / cg" |
303 | 4053 |
! |
4054 |
||
4055 |
invalidateModule:handle |
|
4056 |
"invalidate all of the classes code objects ..." |
|
4057 |
||
4058 |
|id| |
|
4059 |
||
4060 |
Verbose ifTrue:[ |
|
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4061 |
'invalidate module; name=' errorPrint. handle pathName errorPrint. |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4062 |
' id=' errorPrint. handle moduleID errorPrintCR. |
303 | 4063 |
]. |
4064 |
||
4065 |
id := handle moduleID. |
|
4066 |
%{ |
|
4067 |
__INVALIDATE_BY_ID(__intVal(id)); |
|
4068 |
%} |
|
4069 |
! |
|
4070 |
||
4071 |
loadStatusFor:className |
|
2456 | 4072 |
"ask VM if class-hierarchy has been completely loaded, and return the status. |
2705 | 4073 |
If className ist non-nil, check the load status of this class only, |
2456 | 4074 |
otherwise check the status of all known classes. |
4075 |
||
4076 |
Answer an array with the status symbol and optionally the name of |
|
4077 |
a class with a bad status." |
|
303 | 4078 |
|
4079 |
|checker checkSymbol statusCode status badClassName| |
|
4080 |
||
4081 |
checker := self. |
|
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4082 |
checkSymbol := #classPresentCheck:. |
303 | 4083 |
|
4084 |
%{ /* NOREGISTER */ |
|
4085 |
char *badName; |
|
2705 | 4086 |
char interestingClassName[512], *classNameP = 0; |
303 | 4087 |
|
1759
a49b7066594c
UNLIMITEDSTACK for windows, too
Stefan Vogel <sv@exept.de>
parents:
1745
diff
changeset
|
4088 |
if (__isStringLike(className)) { |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4089 |
strncpy(interestingClassName, __stringVal(className), sizeof(interestingClassName)); |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4090 |
classNameP = interestingClassName; |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4091 |
} |
2705 | 4092 |
statusCode = __MKSMALLINT(__check_registration__(classNameP, |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4093 |
&checker, &checkSymbol, |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4094 |
&badName)); |
303 | 4095 |
if (badName) { |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4096 |
badClassName = __MKSTRING(badName); |
303 | 4097 |
} |
4098 |
%}. |
|
4099 |
statusCode == 0 ifTrue:[ |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4100 |
status := #ok |
972
3ae444a1a816
better diagnostics / revalidate after autoload during classLib loading
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
4101 |
] ifFalse:[ statusCode == -1 ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4102 |
status := #missingClass |
972
3ae444a1a816
better diagnostics / revalidate after autoload during classLib loading
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
4103 |
] ifFalse:[ statusCode == -2 ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4104 |
status := #versionMismatch |
972
3ae444a1a816
better diagnostics / revalidate after autoload during classLib loading
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
4105 |
] ifFalse:[ statusCode == -3 ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4106 |
status := #unregisteredSuperclass |
972
3ae444a1a816
better diagnostics / revalidate after autoload during classLib loading
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
4107 |
] ifFalse:[ statusCode == -4 ifTrue:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4108 |
status := #tryAgain |
303 | 4109 |
] ifFalse:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4110 |
status := #loadFailed |
972
3ae444a1a816
better diagnostics / revalidate after autoload during classLib loading
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
4111 |
] ] ] ] ]. |
3ae444a1a816
better diagnostics / revalidate after autoload during classLib loading
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
4112 |
|
303 | 4113 |
^ Array with:status with:badClassName. |
4114 |
! |
|
4115 |
||
4116 |
moduleInit:phase forceOld:forceOld interruptable:interruptable |
|
4117 |
"initialization phases after registration. |
|
1759
a49b7066594c
UNLIMITEDSTACK for windows, too
Stefan Vogel <sv@exept.de>
parents:
1745
diff
changeset
|
4118 |
DANGER: Pure magic; internal only -> don't use in your programs." |
303 | 4119 |
|
1959 | 4120 |
self primModuleInit:phase forceOld:forceOld interruptable:interruptable |
4121 |
||
4122 |
"Modified: / 06-12-2006 / 13:09:43 / cg" |
|
303 | 4123 |
! |
4124 |
||
4125 |
performModuleInitAt:initAddr for:className identifyAs:handle |
|
4126 |
"Initialize a loaded smalltalk module." |
|
4127 |
||
916
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
4128 |
^ self |
1010 | 4129 |
performModuleInitAt:initAddr invokeInitializeMethods:true for:className identifyAs:handle. |
916
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
4130 |
|
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
4131 |
! |
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
4132 |
|
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
4133 |
performModuleInitAt:initAddr invokeInitializeMethods:invokeInitializeMethods for:className identifyAs:handle |
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
4134 |
"Initialize a loaded smalltalk module." |
a04d8cad48d8
when reloading object modules after snapIn,
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
4135 |
|
972
3ae444a1a816
better diagnostics / revalidate after autoload during classLib loading
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
4136 |
|status badClassName infoCollection info classNames classes |
3ae444a1a816
better diagnostics / revalidate after autoload during classLib loading
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
4137 |
stillTrying| |
303 | 4138 |
|
4139 |
" |
|
4140 |
need 4 passes to init: 0: let module register itself & create its pools/globals |
|
3006 | 4141 |
0b check if modules superclasses are all loaded |
4142 |
1: let it get var-refs to other pools/globals |
|
4143 |
2: let it install install class, methods and literals |
|
4144 |
3: let it send #initialize to its class object |
|
303 | 4145 |
" |
4146 |
||
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4147 |
Verbose ifTrue:[ |
3006 | 4148 |
'start' errorPrintCR |
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4149 |
]. |
3006 | 4150 |
|
2456 | 4151 |
[ |
3006 | 4152 |
stillTrying := false. |
4153 |
||
4154 |
"/ |
|
4155 |
"/ let it register itself |
|
4156 |
"/ and define its globals |
|
4157 |
"/ |
|
4158 |
Verbose ifTrue:[ |
|
4159 |
'phase 0 (module registration) ...' errorPrintCR |
|
4160 |
]. |
|
4161 |
self |
|
4162 |
saveCallInitFunctionAt:initAddr |
|
4163 |
in:nil |
|
4164 |
specialInit:true |
|
4165 |
forceOld:true |
|
4166 |
interruptable:false |
|
4167 |
argument:0 |
|
4168 |
identifyAs:handle |
|
4169 |
returnsObject:false. |
|
4170 |
||
4171 |
"/ |
|
4172 |
"/ check if superclasses are present |
|
4173 |
"/ |
|
4174 |
info := self loadStatusFor:className. |
|
4175 |
status := info at:1. |
|
4176 |
badClassName := info at:2. |
|
4177 |
||
4178 |
Verbose ifTrue:[ |
|
4179 |
'... info is ' errorPrint. info errorPrintCR |
|
4180 |
]. |
|
4181 |
||
4182 |
(status ~~ #ok) ifTrue:[ |
|
4183 |
(status == #missingClass) ifTrue:[ |
|
4184 |
('ObjectFileLoader [error]: load failed - missing class: ' , badClassName) infoPrintCR. |
|
4185 |
^ info |
|
4186 |
]. |
|
4187 |
(status == #versionMismatch) ifTrue:[ |
|
4188 |
('ObjectFileLoader [error]: load failed - version mismatch: ' , badClassName) infoPrintCR. |
|
4189 |
^ info |
|
4190 |
]. |
|
4191 |
(status == #unregisteredSuperclass) ifTrue:[ |
|
4192 |
('ObjectFileLoader [error]: load failed - unregistered: ' , badClassName) infoPrintCR. |
|
4193 |
^ info |
|
4194 |
]. |
|
4195 |
(status == #tryAgain) ifTrue:[ |
|
4196 |
"/ tryAgain: |
|
4197 |
"/ must retry after initialization, to initialize |
|
4198 |
"/ sub-subclasses of autoloaded classes |
|
4199 |
"/ (sigh - class objects are created in phase 3, |
|
4200 |
"/ so we must first complete the initialization cycle, |
|
4201 |
"/ then do all again, for remaining modules) |
|
4202 |
stillTrying := true. |
|
4203 |
'ObjectFileLoader [info]: retry registration of: ' infoPrint. |
|
4204 |
(className ? 'a classLib') infoPrint. ' after init' infoPrintCR. |
|
4205 |
] ifFalse:[ |
|
4206 |
'ObjectFileLoader [error]: load failed: ' infoPrint. className infoPrintCR. |
|
4207 |
^ Array with:#loadFailed with:nil |
|
4208 |
]. |
|
4209 |
]. |
|
4210 |
||
4211 |
Smalltalk flushCachedClasses. |
|
4212 |
Class flushSubclassInfo. |
|
4213 |
"/ |
|
4214 |
"/ remaining initialization |
|
4215 |
"/ |
|
4216 |
||
4217 |
"/ module exports: declare module-globals & symbols ... |
|
4218 |
Verbose ifTrue:[ |
|
4219 |
'phase 1 (resolve globals) ...' errorPrintCR |
|
4220 |
]. |
|
4221 |
self moduleInit:1 forceOld:true interruptable:false. |
|
4222 |
||
4223 |
"/ module-imports: resolve globals ... |
|
4224 |
"/ create methods & install ... |
|
4225 |
Verbose ifTrue:[ |
|
4226 |
'phase 2 (create objects) ...' errorPrintCR |
|
4227 |
]. |
|
4228 |
self moduleInit:2 forceOld:true interruptable:false. |
|
4229 |
||
4230 |
Verbose ifTrue:[ |
|
4231 |
'stillTrying is ' errorPrint. stillTrying errorPrintCR |
|
4232 |
]. |
|
2456 | 4233 |
] doWhile:[stillTrying]. |
4234 |
||
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4235 |
Verbose ifTrue:[ |
3006 | 4236 |
'end' errorPrintCR |
303 | 4237 |
]. |
4238 |
||
4239 |
ObjectMemory flushCaches. |
|
4240 |
||
1958
62e95d1c9501
initialize classes BEFORE asking for moduleInfo.
Claus Gittinger <cg@exept.de>
parents:
1942
diff
changeset
|
4241 |
invokeInitializeMethods ifTrue:[ |
3006 | 4242 |
Verbose ifTrue:[ |
4243 |
'phase 3 (send #initialize) ...' errorPrintCR |
|
4244 |
]. |
|
4245 |
"/ initialize ... |
|
4246 |
self moduleInit:3 forceOld:false interruptable:true. |
|
1958
62e95d1c9501
initialize classes BEFORE asking for moduleInfo.
Claus Gittinger <cg@exept.de>
parents:
1942
diff
changeset
|
4247 |
]. |
62e95d1c9501
initialize classes BEFORE asking for moduleInfo.
Claus Gittinger <cg@exept.de>
parents:
1942
diff
changeset
|
4248 |
|
303 | 4249 |
"/ ask objectMemory for the classes we have just loaded |
4250 |
"/ and register them in the handle |
|
4251 |
||
4252 |
infoCollection := ObjectMemory binaryModuleInfo. |
|
4253 |
info := infoCollection at:handle moduleID ifAbsent:nil. |
|
4254 |
info isNil ifTrue:[ |
|
3006 | 4255 |
"/ mhmh registration failed - |
4256 |
'ObjectFileLoader [error]: registration failed: ' infoPrint. |
|
4257 |
(className ? 'some classLib') infoPrintCR. |
|
4258 |
^ Array with:#registrationFailed with:nil |
|
303 | 4259 |
]. |
4260 |
||
405
92cb91b82cf7
changes for new moduleInfo reply
Claus Gittinger <cg@exept.de>
parents:
404
diff
changeset
|
4261 |
classNames := info classNames. |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
4262 |
classNames notEmptyOrNil ifTrue:[ |
3006 | 4263 |
classes := OrderedCollection new:classNames size. |
4264 |
classNames do:[:eachClassName | |class| |
|
4265 |
class := Smalltalk classNamed:eachClassName. |
|
4266 |
class notNil ifTrue:[ |
|
4267 |
classes add:class. |
|
4268 |
]. |
|
4269 |
]. |
|
303 | 4270 |
]. |
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
4271 |
classes notEmptyOrNil ifTrue:[ |
3006 | 4272 |
classes := classes asArray. |
4273 |
classes := classes , (classes collect:[:aClass | aClass class]). |
|
303 | 4274 |
]. |
4275 |
handle classes:classes. |
|
4276 |
||
1958
62e95d1c9501
initialize classes BEFORE asking for moduleInfo.
Claus Gittinger <cg@exept.de>
parents:
1942
diff
changeset
|
4277 |
"/ invokeinitializemethods iftrue:[ |
62e95d1c9501
initialize classes BEFORE asking for moduleInfo.
Claus Gittinger <cg@exept.de>
parents:
1942
diff
changeset
|
4278 |
"/ verbose iftrue:[ |
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4279 |
"/ 'phase 3 (send #initialize) ...' errorPrintCR |
1958
62e95d1c9501
initialize classes BEFORE asking for moduleInfo.
Claus Gittinger <cg@exept.de>
parents:
1942
diff
changeset
|
4280 |
"/ ]. |
62e95d1c9501
initialize classes BEFORE asking for moduleInfo.
Claus Gittinger <cg@exept.de>
parents:
1942
diff
changeset
|
4281 |
"/ "/ INITIALIZE ... |
62e95d1c9501
initialize classes BEFORE asking for moduleInfo.
Claus Gittinger <cg@exept.de>
parents:
1942
diff
changeset
|
4282 |
"/ self moduleinit:3 forceold:false interruptable:true. |
62e95d1c9501
initialize classes BEFORE asking for moduleInfo.
Claus Gittinger <cg@exept.de>
parents:
1942
diff
changeset
|
4283 |
"/ ]. |
881
ed4efb1b161e
perform moduleInit3 AFTER registering the module.
Claus Gittinger <cg@exept.de>
parents:
880
diff
changeset
|
4284 |
|
303 | 4285 |
^ Array with:#ok with:nil |
4286 |
||
1540
72bdddf92706
Avoid error messages about nil classes
Stefan Vogel <sv@exept.de>
parents:
1448
diff
changeset
|
4287 |
"Modified: / 29-07-2004 / 17:12:28 / stefan" |
2459 | 4288 |
"Modified: / 15-11-2010 / 13:20:11 / cg" |
303 | 4289 |
! |
4290 |
||
1959 | 4291 |
primModuleInit:phase forceOld:forceOld interruptable:interruptable |
4292 |
"initialization phases after registration. |
|
4293 |
DANGER: Pure magic; internal only -> don't use in your programs." |
|
4294 |
||
4295 |
%{ |
|
4296 |
int prevSpace, force; |
|
4297 |
int wasBlocked = 1; |
|
4298 |
||
4299 |
if (__isSmallInteger(phase)) { |
|
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4300 |
if (interruptable != true) { |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4301 |
wasBlocked = (__BLOCKINTERRUPTS() == true); |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4302 |
} |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4303 |
|
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4304 |
force = (forceOld == true); |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4305 |
if (force) { |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4306 |
prevSpace = __allocForceSpace(OLDSPACE); |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4307 |
} |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4308 |
|
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4309 |
__init_registered_modules__(__intVal(phase)); |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4310 |
|
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4311 |
if (force) { |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4312 |
__allocForceSpace(prevSpace); |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4313 |
} |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4314 |
|
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4315 |
if (! wasBlocked) { |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4316 |
__UNBLOCKINTERRUPTS(); |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4317 |
} |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4318 |
RETURN (self); |
1959 | 4319 |
} |
4320 |
%}. |
|
4321 |
self primitiveFailed |
|
4322 |
||
4323 |
"Created: / 06-12-2006 / 13:09:24 / cg" |
|
4324 |
! |
|
4325 |
||
303 | 4326 |
revalidateModule:handle |
4327 |
"revalidate all of the classes code objects ..." |
|
4328 |
||
4329 |
|id| |
|
4330 |
||
4331 |
Verbose ifTrue:[ |
|
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4332 |
'revalidate module; name=' errorPrint. handle pathName errorPrint. |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4333 |
' id=' errorPrint. handle moduleID errorPrintCR. |
303 | 4334 |
]. |
4335 |
||
4336 |
id := handle moduleID. |
|
4337 |
%{ |
|
4338 |
__REVALIDATE_BY_ID(__intVal(id)); |
|
4339 |
%} |
|
4340 |
! |
|
4341 |
||
2459 | 4342 |
saveCallInitFunctionAt:address in:aFilenameOrNil specialInit:special forceOld:forceOld interruptable:interruptable argument:argument identifyAs:handle returnsObject:returnsObject |
4343 |
OSSignalInterrupt handle:[:ex | |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4344 |
aFilenameOrNil notNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4345 |
('ObjectFileLoader [warning]: SignalInterrupt from initFunction in %1' bindWith:(aFilenameOrNil asFilename pathName)) errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4346 |
] ifFalse:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4347 |
'ObjectFileLoader [warning]: SignalInterrupt from initFunction' errorPrintCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4348 |
]. |
2459 | 4349 |
] do:[ |
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4350 |
^ self |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4351 |
callInitFunctionAt:address |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4352 |
specialInit:special |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4353 |
forceOld:forceOld |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4354 |
interruptable:interruptable |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4355 |
argument:argument |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4356 |
identifyAs:handle |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4357 |
returnsObject:returnsObject |
2459 | 4358 |
]. |
4359 |
||
4360 |
"Created: / 15-11-2010 / 13:21:59 / cg" |
|
4361 |
! |
|
4362 |
||
303 | 4363 |
unregisterModule:handle |
4364 |
"unregister classes in the VM. |
|
4365 |
This invalidates all of the classes code objects ..." |
|
4366 |
||
4367 |
|id| |
|
4368 |
||
4369 |
Verbose ifTrue:[ |
|
1964
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4370 |
'unregister module; name=' errorPrint. handle pathName errorPrint. |
f037d5288371
registration for extension modules changed (check for classes being present)
Claus Gittinger <cg@exept.de>
parents:
1961
diff
changeset
|
4371 |
' id=' errorPrint. handle moduleID errorPrintCR. |
303 | 4372 |
]. |
4373 |
||
4374 |
id := handle moduleID. |
|
4375 |
%{ |
|
4376 |
__UNREGISTER_BY_ID(__intVal(id)); |
|
4377 |
%} |
|
4378 |
! ! |
|
4379 |
||
2408 | 4380 |
!ObjectFileLoader class methodsFor:'under test - loading dlls'! |
4381 |
||
4382 |
loadObjectFiles:aSeqOfFiles |
|
4383 |
"load a sequence of DLLs... first load all DLLs with #moduleInit:0 |
|
2661 | 4384 |
then call #moduleInit:1, #moduleInit:2 and #moduleInit:3 for all loaded DLLs. |
4385 |
||
4386 |
*** UNDER TEST ... |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4387 |
used by ExpeccoStartup under windows. |
2408 | 4388 |
|
2661 | 4389 |
not supported is C,... |
2408 | 4390 |
" |
2661 | 4391 |
|
2408 | 4392 |
|filename handle initAddr className infoCollection handles info| |
4393 |
||
4394 |
aSeqOfFiles isEmptyOrNil ifTrue:[^ self]. |
|
4395 |
||
4396 |
handles := OrderedCollection new. |
|
4397 |
||
4398 |
Smalltalk flushCachedClasses. |
|
4399 |
Class flushSubclassInfo. |
|
4400 |
||
4401 |
aSeqOfFiles do:[:each| |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4402 |
filename := each asFilename. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4403 |
handle := self handleForDynamicObject:filename. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4404 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4405 |
handle isNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4406 |
Smalltalk showSplashMessage:('loading ', filename baseName). |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4407 |
handle := self loadDynamicObject:filename. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4408 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4409 |
handle notNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4410 |
className := self initFunctionBasenameForFile:filename. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4411 |
initAddr := self findInitFunction:className in:handle. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4412 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4413 |
initAddr notNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4414 |
[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4415 |
self |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4416 |
saveCallInitFunctionAt:initAddr |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4417 |
in:filename |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4418 |
specialInit:true |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4419 |
forceOld:true |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4420 |
interruptable:false |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4421 |
argument:0 |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4422 |
identifyAs:handle |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4423 |
returnsObject:false. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4424 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4425 |
info := self loadStatusFor:nil. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4426 |
(info first == #tryAgain) |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4427 |
] whileTrue. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4428 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4429 |
info first == #ok ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4430 |
handles add:handle |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4431 |
] ifFalse:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4432 |
( '%1: error during init: %2' bindWith:each with:info) printCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4433 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4434 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4435 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4436 |
]. |
2408 | 4437 |
]. |
2661 | 4438 |
Smalltalk showSplashMessage:('initializing modules-1...'). |
2408 | 4439 |
self moduleInit:1 forceOld:true interruptable:false. |
2661 | 4440 |
Smalltalk showSplashMessage:('initializing modules-2...'). |
2408 | 4441 |
self moduleInit:2 forceOld:true interruptable:false. |
4442 |
ObjectMemory flushCaches. |
|
2661 | 4443 |
Smalltalk showSplashMessage:('initializing modules-3...'). |
2408 | 4444 |
self moduleInit:3 forceOld:false interruptable:true. |
4445 |
||
4446 |
infoCollection := ObjectMemory binaryModuleInfo. |
|
4447 |
||
4448 |
handles do:[:each| |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4449 |
|classNames classes| |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4450 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4451 |
info := infoCollection at:(handle moduleID) ifAbsent:nil. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4452 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4453 |
info isNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4454 |
('error - nil info: %1' bindWith:handle ) printCR. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4455 |
] ifFalse:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4456 |
classNames := info classNames. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4457 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4458 |
classNames notEmptyOrNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4459 |
classes := OrderedCollection new:classNames size. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4460 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4461 |
classNames do:[:eachClassName | |class| |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4462 |
class := Smalltalk classNamed:eachClassName. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4463 |
class notNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4464 |
classes add:class. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4465 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4466 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4467 |
classes notEmptyOrNil ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4468 |
classes := classes asArray. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4469 |
classes := classes , (classes collect:[:aClass | aClass class]). |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4470 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4471 |
handle classes:classes. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4472 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4473 |
]. |
2408 | 4474 |
]. |
2661 | 4475 |
Smalltalk showSplashMessage:('done loading modules.'). |
2408 | 4476 |
|
4477 |
" |
|
4478 |
|directory filename dlls| |
|
4479 |
||
4480 |
directory := 'C:\Dokumente und Einstellungen\Steffen Jung\work\exept\expecco\application' asFilename. |
|
4481 |
filename := directory construct:'modules.stx'. |
|
4482 |
||
4483 |
dlls := OrderedCollection new. |
|
4484 |
||
4485 |
filename readingLinesDo:[:aLine| |
|
2744
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4486 |
|line dllFile| |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4487 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4488 |
line := aLine withoutSeparators. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4489 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4490 |
line size > 3 ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4491 |
line first ~~ $# ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4492 |
dllFile := directory construct:(line, '.dll'). |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4493 |
|
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4494 |
dllFile exists ifTrue:[ |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4495 |
dlls add:dllFile. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4496 |
]. |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4497 |
] |
fb0de2fb6f3b
changed: #reloadAllRememberedObjectFiles
Stefan Vogel <sv@exept.de>
parents:
2705
diff
changeset
|
4498 |
] |
2408 | 4499 |
]. |
4500 |
ObjectFileLoader loadObjectFiles:dlls. |
|
4501 |
" |
|
2459 | 4502 |
|
2661 | 4503 |
"Modified: / 11-08-2011 / 17:25:52 / cg" |
2408 | 4504 |
! ! |
4505 |
||
369 | 4506 |
!ObjectFileLoader class methodsFor:'documentation'! |
148 | 4507 |
|
4508 |
version |
|
3172 | 4509 |
^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.351 2013-05-21 20:27:25 cg Exp $' |
2256
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
4510 |
! |
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
4511 |
|
dba660aa4c26
change __isString() to __isStringLike() in primitive code
Stefan Vogel <sv@exept.de>
parents:
2184
diff
changeset
|
4512 |
version_CVS |
3172 | 4513 |
^ '$Header: /cvs/stx/stx/libcomp/ObjectFileLoader.st,v 1.351 2013-05-21 20:27:25 cg Exp $' |
148 | 4514 |
! ! |
1358 | 4515 |
|
2992 | 4516 |
|
0 | 4517 |
ObjectFileLoader initialize! |