1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
-
+
|
/*
* tclLoadDyld.c --
*
* This procedure provides a version of the TclLoadFile that
* works with Apple's dyld dynamic loading. This file
* provided by Wilfredo Sanchez (wsanchez@apple.com).
* This works on Mac OS X.
*
* Copyright (c) 1995 Apple Computer, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* RCS: @(#) $Id: tclLoadDyld.c,v 1.2.2.2 2001/10/16 06:44:09 das Exp $
* RCS: @(#) $Id: tclLoadDyld.c,v 1.2.2.2.2.1 2001/11/28 17:58:37 andreas_kupries Exp $
*/
#include "tclInt.h"
#include <mach-o/dyld.h>
/*
*----------------------------------------------------------------------
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
+
|
*
* Side effects:
* New code suddenly appears in memory.
*
*----------------------------------------------------------------------
*/
#ifndef TCL_NO_LOADCMD
int
TclpLoadFile(interp, fileName, sym1, sym2, proc1Ptr, proc2Ptr, clientDataPtr)
Tcl_Interp *interp; /* Used for error reporting. */
char *fileName; /* Name of the file containing the desired
* code. */
char *sym1, *sym2; /* Names of two procedures to look up in
* the file's symbol table. */
|
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
+
+
+
|
*proc2Ptr=NULL;
}
Tcl_DStringFree(&newName);
Tcl_DStringFree(&ds);
return TCL_OK;
}
#endif
/*
*----------------------------------------------------------------------
*
* TclpUnloadFile --
*
* Unloads a dynamically loaded binary code file from memory.
* Code pointers in the formerly loaded file are no longer valid
* after calling this function.
*
* Results:
* None.
*
* Side effects:
* Code dissapears from memory.
* Note that this is a no-op on older (OpenStep) versions of dyld.
*
*----------------------------------------------------------------------
*/
#ifndef TCL_NO_LOADCMD
void
TclpUnloadFile(clientData)
ClientData clientData; /* ClientData returned by a previous call
* to TclpLoadFile(). The clientData is
* a token that represents the loaded
* file. */
{
NSUnLinkModule(clientData, FALSE);
}
#endif
/*
*----------------------------------------------------------------------
*
* TclGuessPackageName --
*
* If the "load" command is invoked without providing a package
|