Commit | Line | Data |
0a753a76 |
1 | #!../miniperl |
2 | |
22c35a8c |
3 | # Create the export list for perl. Needed by WIN32 for creating perl.dll. |
0a753a76 |
4 | |
22c35a8c |
5 | # reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h |
0a753a76 |
6 | |
910dfcc8 |
7 | my $CCTYPE = "MSVC"; # default |
8 | |
9 | while (@ARGV) |
d55594ae |
10 | { |
11 | my $flag = shift; |
12 | $define{$1} = 1 if ($flag =~ /^-D(\w+)$/); |
910dfcc8 |
13 | $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/); |
d55594ae |
14 | } |
15 | |
bbc8f9de |
16 | open(CFG,'config.h') || die "Cannot open config.h:$!"; |
17 | while (<CFG>) |
18 | { |
19 | $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/; |
924b3ec4 |
20 | $define{$1} = 1 if /^\s*#\s*define\s+(USE_THREADS)\b/; |
b86a2fa7 |
21 | $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/; |
bbc8f9de |
22 | } |
23 | close(CFG); |
24 | |
d55594ae |
25 | warn join(' ',keys %define)."\n"; |
26 | |
ac4c12e7 |
27 | if ($define{PERL_OBJECT}) { |
28 | print "LIBRARY PerlCore\n"; |
29 | print "DESCRIPTION 'Perl interpreter'\n"; |
30 | print "EXPORTS\n"; |
31 | output_symbol("perl_alloc"); |
32 | exit(0); |
33 | } |
34 | |
04dc04aa |
35 | if ($CCTYPE ne 'GCC') |
36 | { |
37 | print "LIBRARY Perl\n"; |
38 | print "DESCRIPTION 'Perl interpreter, export autogenerated'\n"; |
04dc04aa |
39 | } |
22239a37 |
40 | else |
41 | { |
42 | $define{'PERL_GLOBAL_STRUCT'} = 1; |
43 | $define{'MULTIPLICITY'} = 1; |
44 | } |
45 | |
bbc8f9de |
46 | print "EXPORTS\n"; |
47 | |
22239a37 |
48 | my %skip; |
49 | my %export; |
50 | |
51 | sub skip_symbols |
52 | { |
53 | my $list = shift; |
54 | foreach my $symbol (@$list) |
55 | { |
56 | $skip{$symbol} = 1; |
57 | } |
58 | } |
59 | |
60 | sub emit_symbols |
61 | { |
62 | my $list = shift; |
63 | foreach my $symbol (@$list) |
64 | { |
65 | emit_symbol($symbol) unless exists $skip{$symbol}; |
66 | } |
67 | } |
68 | |
69 | skip_symbols [qw( |
db15561c |
70 | PL_statusvalue_vms |
71 | PL_archpat_auto |
72 | PL_cryptseen |
73 | PL_DBcv |
74 | PL_generation |
db15561c |
75 | PL_lastgotoprobe |
76 | PL_linestart |
77 | PL_modcount |
78 | PL_pending_ident |
79 | PL_sortcxix |
80 | PL_sublex_info |
81 | PL_timesbuf |
a6c40364 |
82 | Perl_do_exec3 |
0a753a76 |
83 | Perl_do_ipcctl |
84 | Perl_do_ipcget |
85 | Perl_do_msgrcv |
86 | Perl_do_msgsnd |
87 | Perl_do_semop |
88 | Perl_do_shmio |
0a753a76 |
89 | Perl_dump_fds |
d55594ae |
90 | Perl_init_thread_intern |
0a753a76 |
91 | Perl_my_bzero |
92 | Perl_my_htonl |
93 | Perl_my_ntohl |
94 | Perl_my_swap |
95 | Perl_my_chsize |
0a753a76 |
96 | Perl_same_dirent |
68dc0745 |
97 | Perl_setenv_getix |
0a753a76 |
98 | Perl_unlnk |
0a753a76 |
99 | Perl_watch |
0a753a76 |
100 | Perl_safexcalloc |
101 | Perl_safexmalloc |
102 | Perl_safexfree |
103 | Perl_safexrealloc |
68dc0745 |
104 | Perl_my_memcmp |
8b10511d |
105 | Perl_my_memset |
db15561c |
106 | PL_cshlen |
107 | PL_cshname |
108 | PL_opsave |
22239a37 |
109 | )]; |
0a753a76 |
110 | |
c69f112c |
111 | |
bbc8f9de |
112 | if ($define{'MYMALLOC'}) |
113 | { |
22239a37 |
114 | emit_symbols [qw( |
9423c6fc |
115 | Perl_dump_mstats |
22239a37 |
116 | Perl_malloc |
f2517201 |
117 | Perl_mfree |
22239a37 |
118 | Perl_realloc |
119 | Perl_calloc)]; |
bbc8f9de |
120 | } |
32fcaa0b |
121 | else |
122 | { |
123 | skip_symbols [qw( |
df31f264 |
124 | Perl_dump_mstats |
32fcaa0b |
125 | Perl_malloced_size)]; |
126 | } |
bbc8f9de |
127 | |
d55594ae |
128 | unless ($define{'USE_THREADS'}) |
129 | { |
22239a37 |
130 | skip_symbols [qw( |
db15561c |
131 | PL_thr_key |
132 | PL_sv_mutex |
46124e9e |
133 | PL_strtab_mutex |
db15561c |
134 | PL_svref_mutex |
135 | PL_malloc_mutex |
5ff3f7a4 |
136 | PL_cred_mutex |
db15561c |
137 | PL_eval_mutex |
138 | PL_eval_cond |
139 | PL_eval_owner |
140 | PL_threads_mutex |
141 | PL_nthreads |
142 | PL_nthreads_cond |
143 | PL_threadnum |
144 | PL_threadsv_names |
145 | PL_thrsv |
22c35a8c |
146 | PL_vtbl_mutex |
eb480a0b |
147 | Perl_getTHR |
148 | Perl_setTHR |
d55594ae |
149 | Perl_condpair_magic |
32f822de |
150 | Perl_new_struct_thread |
32f822de |
151 | Perl_per_thread_magicals |
d4cce5f1 |
152 | Perl_thread_create |
153 | Perl_find_threadsv |
d55594ae |
154 | Perl_unlock_condpair |
d55594ae |
155 | Perl_magic_mutexfree |
95906810 |
156 | )]; |
910dfcc8 |
157 | } |
d4cce5f1 |
158 | |
910dfcc8 |
159 | unless ($define{'FAKE_THREADS'}) |
160 | { |
db15561c |
161 | skip_symbols [qw(PL_curthr)]; |
d55594ae |
162 | } |
163 | |
22239a37 |
164 | sub readvar |
165 | { |
166 | my $file = shift; |
167 | open(VARS,$file) || die "Cannot open $file:$!"; |
168 | my @syms; |
169 | while (<VARS>) |
170 | { |
171 | # All symbols have a Perl_ prefix because that's what embed.h |
172 | # sticks in front of them. |
db15561c |
173 | push(@syms,"PL_".$1) if (/\bPERLVARI?C?\([IGT](\w+)/); |
22239a37 |
174 | } |
175 | close(VARS); |
176 | return \@syms; |
177 | } |
178 | |
d4cce5f1 |
179 | if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'}) |
d55594ae |
180 | { |
22239a37 |
181 | my $thrd = readvar("../thrdvar.h"); |
182 | skip_symbols $thrd; |
d55594ae |
183 | } |
184 | |
d4cce5f1 |
185 | if ($define{'MULTIPLICITY'}) |
d55594ae |
186 | { |
22239a37 |
187 | my $interp = readvar("../intrpvar.h"); |
188 | skip_symbols $interp; |
189 | } |
190 | |
191 | if ($define{'PERL_GLOBAL_STRUCT'}) |
192 | { |
193 | my $global = readvar("../perlvars.h"); |
194 | skip_symbols $global; |
852c2e52 |
195 | emit_symbols [qw(Perl_GetVars)]; |
db15561c |
196 | emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC'; |
d4cce5f1 |
197 | } |
d55594ae |
198 | |
36c15d3f |
199 | unless ($define{'DEBUGGING'}) |
200 | { |
22239a37 |
201 | skip_symbols [qw( |
fea7140c |
202 | Perl_deb |
203 | Perl_deb_growlevel |
204 | Perl_debop |
205 | Perl_debprofdump |
206 | Perl_debstack |
207 | Perl_debstackptrs |
22239a37 |
208 | Perl_runops_debug |
209 | Perl_sv_peek |
3836fe67 |
210 | PL_block_type |
22c35a8c |
211 | PL_watchaddr |
212 | PL_watchok)]; |
36c15d3f |
213 | } |
214 | |
26618a56 |
215 | if ($define{'HAVE_DES_FCRYPT'}) |
216 | { |
217 | emit_symbols [qw(win32_crypt)]; |
218 | } |
219 | |
22c35a8c |
220 | # functions from *.sym files |
221 | |
222 | for my $syms ('../global.sym','../pp.sym', '../globvar.sym') |
22239a37 |
223 | { |
22c35a8c |
224 | open (GLOBAL, "<$syms") || die "failed to open $syms" . $!; |
225 | while (<GLOBAL>) |
226 | { |
227 | next if (!/^[A-Za-z]/); |
228 | # Functions have a Perl_ prefix |
229 | # Variables have a PL_ prefix |
230 | chomp($_); |
231 | my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "Perl_"); |
232 | $symbol .= $_; |
233 | emit_symbol($symbol) unless exists $skip{$symbol}; |
234 | } |
235 | close(GLOBAL); |
22239a37 |
236 | } |
0a753a76 |
237 | |
22c35a8c |
238 | # variables |
0a753a76 |
239 | |
852c2e52 |
240 | unless ($define{'PERL_GLOBAL_STRUCT'}) |
22239a37 |
241 | { |
242 | my $glob = readvar("../perlvars.h"); |
243 | emit_symbols $glob; |
244 | } |
245 | |
246 | unless ($define{'MULTIPLICITY'}) |
247 | { |
248 | my $glob = readvar("../intrpvar.h"); |
249 | emit_symbols $glob; |
250 | } |
0a753a76 |
251 | |
22239a37 |
252 | unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) |
253 | { |
254 | my $glob = readvar("../thrdvar.h"); |
255 | emit_symbols $glob; |
256 | } |
0a753a76 |
257 | |
258 | while (<DATA>) { |
259 | my $symbol; |
260 | next if (!/^[A-Za-z]/); |
261 | next if (/^#/); |
a868473f |
262 | s/\r//g; |
22239a37 |
263 | chomp($_); |
0a753a76 |
264 | $symbol = $_; |
22239a37 |
265 | next if exists $skip{$symbol}; |
3e3baf6d |
266 | emit_symbol($symbol); |
267 | } |
268 | |
22239a37 |
269 | foreach my $symbol (sort keys %export) |
270 | { |
ac4c12e7 |
271 | output_symbol($symbol); |
22239a37 |
272 | } |
273 | |
274 | sub emit_symbol { |
275 | my $symbol = shift; |
276 | chomp($symbol); |
277 | $export{$symbol} = 1; |
3e3baf6d |
278 | } |
0a753a76 |
279 | |
ac4c12e7 |
280 | sub output_symbol { |
281 | my $symbol = shift; |
282 | if ($CCTYPE eq "BORLAND") { |
283 | # workaround Borland quirk by exporting both the straight |
284 | # name and a name with leading underscore. Note the |
285 | # alias *must* come after the symbol itself, if both |
286 | # are to be exported. (Linker bug?) |
287 | print "\t_$symbol\n"; |
288 | print "\t$symbol = _$symbol\n"; |
289 | } |
290 | elsif ($CCTYPE eq 'GCC') { |
291 | # Symbols have leading _ whole process is $%£"% slow |
292 | # so skip aliases for now |
293 | print "\t$symbol\n"; |
294 | } |
295 | else { |
296 | # for binary coexistence, export both the symbol and |
297 | # alias with leading underscore |
298 | print "\t$symbol\n"; |
299 | print "\t_$symbol = $symbol\n"; |
300 | } |
301 | } |
302 | |
0a753a76 |
303 | 1; |
304 | __DATA__ |
305 | # extra globals not included above. |
306 | perl_init_i18nl10n |
0a753a76 |
307 | perl_alloc |
4b556e6c |
308 | perl_atexit |
0a753a76 |
309 | perl_construct |
310 | perl_destruct |
311 | perl_free |
312 | perl_parse |
313 | perl_run |
314 | perl_get_sv |
315 | perl_get_av |
316 | perl_get_hv |
317 | perl_get_cv |
318 | perl_call_argv |
319 | perl_call_pv |
320 | perl_call_method |
321 | perl_call_sv |
10dd38fc |
322 | perl_require_pv |
323 | perl_eval_pv |
324 | perl_eval_sv |
6dead956 |
325 | perl_new_ctype |
326 | perl_new_collate |
327 | perl_new_numeric |
328 | perl_set_numeric_standard |
329 | perl_set_numeric_local |
d28b3ca3 |
330 | boot_DynaLoader |
d55594ae |
331 | Perl_thread_create |
68dc0745 |
332 | win32_errno |
96e4d5b1 |
333 | win32_environ |
68dc0745 |
334 | win32_stdin |
335 | win32_stdout |
96e4d5b1 |
336 | win32_stderr |
68dc0745 |
337 | win32_ferror |
338 | win32_feof |
339 | win32_strerror |
340 | win32_fprintf |
341 | win32_printf |
342 | win32_vfprintf |
96e4d5b1 |
343 | win32_vprintf |
68dc0745 |
344 | win32_fread |
345 | win32_fwrite |
346 | win32_fopen |
347 | win32_fdopen |
348 | win32_freopen |
349 | win32_fclose |
350 | win32_fputs |
351 | win32_fputc |
352 | win32_ungetc |
353 | win32_getc |
354 | win32_fileno |
355 | win32_clearerr |
356 | win32_fflush |
357 | win32_ftell |
358 | win32_fseek |
359 | win32_fgetpos |
360 | win32_fsetpos |
361 | win32_rewind |
362 | win32_tmpfile |
363 | win32_abort |
364 | win32_fstat |
96e4d5b1 |
365 | win32_stat |
68dc0745 |
366 | win32_pipe |
367 | win32_popen |
368 | win32_pclose |
e24c7c18 |
369 | win32_rename |
68dc0745 |
370 | win32_setmode |
96e4d5b1 |
371 | win32_lseek |
372 | win32_tell |
68dc0745 |
373 | win32_dup |
374 | win32_dup2 |
96e4d5b1 |
375 | win32_open |
376 | win32_close |
377 | win32_eof |
68dc0745 |
378 | win32_read |
379 | win32_write |
3e3baf6d |
380 | win32_spawnvp |
5aabfad6 |
381 | win32_mkdir |
382 | win32_rmdir |
383 | win32_chdir |
c90c0ff4 |
384 | win32_flock |
eb62e965 |
385 | win32_execv |
6890e559 |
386 | win32_execvp |
54310121 |
387 | win32_htons |
388 | win32_ntohs |
389 | win32_htonl |
390 | win32_ntohl |
391 | win32_inet_addr |
392 | win32_inet_ntoa |
393 | win32_socket |
394 | win32_bind |
395 | win32_listen |
396 | win32_accept |
397 | win32_connect |
398 | win32_send |
399 | win32_sendto |
400 | win32_recv |
401 | win32_recvfrom |
402 | win32_shutdown |
3a25acb4 |
403 | win32_closesocket |
54310121 |
404 | win32_ioctlsocket |
405 | win32_setsockopt |
406 | win32_getsockopt |
407 | win32_getpeername |
408 | win32_getsockname |
409 | win32_gethostname |
410 | win32_gethostbyname |
411 | win32_gethostbyaddr |
412 | win32_getprotobyname |
413 | win32_getprotobynumber |
414 | win32_getservbyname |
415 | win32_getservbyport |
416 | win32_select |
417 | win32_endhostent |
418 | win32_endnetent |
419 | win32_endprotoent |
420 | win32_endservent |
421 | win32_getnetent |
422 | win32_getnetbyname |
423 | win32_getnetbyaddr |
424 | win32_getprotoent |
425 | win32_getservent |
426 | win32_sethostent |
427 | win32_setnetent |
428 | win32_setprotoent |
429 | win32_setservent |
ad2e33dc |
430 | win32_getenv |
ac5c734f |
431 | win32_putenv |
84902520 |
432 | win32_perror |
433 | win32_setbuf |
434 | win32_setvbuf |
435 | win32_flushall |
436 | win32_fcloseall |
437 | win32_fgets |
438 | win32_gets |
439 | win32_fgetc |
440 | win32_putc |
441 | win32_puts |
442 | win32_getchar |
443 | win32_putchar |
444 | win32_malloc |
445 | win32_calloc |
446 | win32_realloc |
447 | win32_free |
f3986ebb |
448 | win32_sleep |
449 | win32_times |
450 | win32_alarm |
65e48ea9 |
451 | win32_open_osfhandle |
452 | win32_get_osfhandle |
f998180f |
453 | win32_ioctl |
ad0751ec |
454 | win32_utime |
b2af26b1 |
455 | win32_uname |
22fae026 |
456 | win32_wait |
f55ee38a |
457 | win32_waitpid |
458 | win32_kill |
22fae026 |
459 | win32_str_os_error |
ce2e26e5 |
460 | win32_opendir |
461 | win32_readdir |
462 | win32_telldir |
463 | win32_seekdir |
464 | win32_rewinddir |
465 | win32_closedir |
8ac9c18d |
466 | win32_longpath |
ad2e33dc |
467 | Perl_win32_init |
f3986ebb |
468 | Perl_init_os_extras |
9811a7d7 |
469 | Perl_getTHR |
0fefa03b |
470 | Perl_setTHR |
84902520 |
471 | RunPerl |
22239a37 |
472 | |