53
symlink(const char *orig, const char *dest)
59
copy_object_file(cl_object original)
62
cl_object s, copy = make_constant_base_string("TMP:ECL");
63
copy = si_coerce_to_filename(si_mkstemp(copy));
65
err = unlink(copy->base_string.self) ||
66
symlink(original->base_string.self, copy->base_string.self);
68
#if defined(mingw32) || defined(_MSC_VER)
69
err = !CopyFile(original->base_string.self, copy->base_string.self, 0);
75
FEerror("Unable to copy file ~A to ~A", 2, original, copy);
50
80
#ifdef ENABLE_DLOPEN
52
ecl_library_open(cl_object filename) {
82
ecl_library_find(cl_object filename)
84
cl_object libraries = cl_core.libraries;
86
for (i = 0; i < libraries->vector.fillp; i++) {
87
if (ecl_string_eq(libraries->vector.self.t[i]->cblock.name,
90
return libraries->vector.self.t[i];
97
ecl_library_open(cl_object filename, bool force_reload) {
54
99
cl_object libraries = cl_core.libraries;
55
100
bool self_destruct = 0;
58
for (i = 0; i < libraries->vector.fillp; i++) {
59
if (ecl_string_eq(libraries->vector.self.t[i]->cblock.name, filename)) {
60
cl_object copy = make_constant_base_string("TMP:ECL");
61
copy = si_coerce_to_filename(si_mkstemp(copy));
62
unlink(copy->base_string.self);
63
symlink(filename->base_string.self, copy->base_string.self);
103
/* When loading a foreign library, such as a dll or a
104
* so, it cannot contain any executable top level
105
* code. In that case force_reload=0 and there is no
106
* need to reload it if it has already been loaded. */
107
block = ecl_library_find(filename);
112
/* We are using shared libraries as modules and
113
* force_reload=1. Here we have to face the problem
114
* that many operating systems do not allow to load a
115
* shared library twice, even if it has changed. Hence
116
* we have to make a unique copy to be able to load
117
* the same FASL twice. In Windows this copy is
118
* _always_ made because otherwise it cannot be
119
* overwritten. In Unix we need only do that when the
120
* file has been previously loaded. */
121
#if defined(mingw32) || defined(_MSC_VER)
122
filename = copy_object_file(filename);
124
block = ecl_library_find(filename);
126
filename = copy_object_file(filename);
65
127
self_destruct = 1;
69
131
block = cl_alloc_object(t_codeblock);
70
132
block->cblock.self_destruct = self_destruct;
71
133
block->cblock.name = filename;
427
489
if (!Null(function)) {
428
490
ok = funcall(4, function, filename, verbose, print);
492
#if 0 /* defined(ENABLE_DLOPEN) && !defined(mingw32) && !defined(_MSC_VER)*/
494
* DISABLED BECAUSE OF SECURITY ISSUES!
495
* In systems where we can do this, we try to load the file
496
* as a binary. When it fails, we will revert to source
497
* loading below. Is this safe? Well, it depends on whether
498
* your op.sys. checks integrity of binary exectables or
499
* just loads _anything_.
431
501
if (not_a_filename) {