Commit | Line | Data |
---|---|---|
0a753a76 | 1 | #!../miniperl |
2 | ||
3 | # Written: 10 April 1996 Gary Ng (71564.1743@compuserve.com) | |
4 | ||
5 | # Create the export list for perl. | |
6 | # Needed by WIN32 for creating perl.dll | |
7 | # based on perl_exp.SH in the main perl distribution directory | |
8 | ||
9 | # This simple program relys on 'global.sym' being up to date | |
10 | # with all of the global symbols that a dynamicly link library | |
11 | # might want to access. | |
12 | ||
13 | # There is some symbol defined in global.sym and interp.sym | |
14 | # that does not present in the WIN32 port but there is no easy | |
84902520 | 15 | # way to find them so I just put a exception list here |
0a753a76 | 16 | |
910dfcc8 | 17 | my $CCTYPE = "MSVC"; # default |
18 | ||
19 | while (@ARGV) | |
d55594ae | 20 | { |
21 | my $flag = shift; | |
22 | $define{$1} = 1 if ($flag =~ /^-D(\w+)$/); | |
910dfcc8 | 23 | $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/); |
d55594ae | 24 | } |
25 | ||
bbc8f9de | 26 | open(CFG,'config.h') || die "Cannot open config.h:$!"; |
27 | while (<CFG>) | |
28 | { | |
29 | $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/; | |
924b3ec4 | 30 | $define{$1} = 1 if /^\s*#\s*define\s+(USE_THREADS)\b/; |
bbc8f9de | 31 | } |
32 | close(CFG); | |
33 | ||
d55594ae | 34 | warn join(' ',keys %define)."\n"; |
35 | ||
ac4c12e7 | 36 | if ($define{PERL_OBJECT}) { |
37 | print "LIBRARY PerlCore\n"; | |
38 | print "DESCRIPTION 'Perl interpreter'\n"; | |
39 | print "EXPORTS\n"; | |
40 | output_symbol("perl_alloc"); | |
41 | exit(0); | |
42 | } | |
43 | ||
04dc04aa | 44 | if ($CCTYPE ne 'GCC') |
45 | { | |
46 | print "LIBRARY Perl\n"; | |
47 | print "DESCRIPTION 'Perl interpreter, export autogenerated'\n"; | |
04dc04aa | 48 | } |
22239a37 | 49 | else |
50 | { | |
51 | $define{'PERL_GLOBAL_STRUCT'} = 1; | |
52 | $define{'MULTIPLICITY'} = 1; | |
53 | } | |
54 | ||
bbc8f9de | 55 | print "EXPORTS\n"; |
56 | ||
22239a37 | 57 | my %skip; |
58 | my %export; | |
59 | ||
60 | sub skip_symbols | |
61 | { | |
62 | my $list = shift; | |
63 | foreach my $symbol (@$list) | |
64 | { | |
65 | $skip{$symbol} = 1; | |
66 | } | |
67 | } | |
68 | ||
69 | sub emit_symbols | |
70 | { | |
71 | my $list = shift; | |
72 | foreach my $symbol (@$list) | |
73 | { | |
74 | emit_symbol($symbol) unless exists $skip{$symbol}; | |
75 | } | |
76 | } | |
77 | ||
78 | skip_symbols [qw( | |
db15561c | 79 | PL_statusvalue_vms |
80 | PL_archpat_auto | |
81 | PL_cryptseen | |
82 | PL_DBcv | |
83 | PL_generation | |
db15561c | 84 | PL_lastgotoprobe |
85 | PL_linestart | |
86 | PL_modcount | |
87 | PL_pending_ident | |
88 | PL_sortcxix | |
89 | PL_sublex_info | |
90 | PL_timesbuf | |
0a753a76 | 91 | Perl_block_type |
0a753a76 | 92 | Perl_additem |
93 | Perl_cast_ulong | |
94 | Perl_check_uni | |
95 | Perl_checkcomma | |
96 | Perl_chsize | |
97 | Perl_ck_aelem | |
0a753a76 | 98 | Perl_cx_dump |
0a753a76 | 99 | Perl_do_ipcctl |
100 | Perl_do_ipcget | |
101 | Perl_do_msgrcv | |
102 | Perl_do_msgsnd | |
103 | Perl_do_semop | |
104 | Perl_do_shmio | |
105 | Perl_doeval | |
106 | Perl_dofindlabel | |
107 | Perl_dopoptoeval | |
108 | Perl_dump_eval | |
109 | Perl_dump_fds | |
110 | Perl_dump_form | |
111 | Perl_dump_gv | |
112 | Perl_dump_mstats | |
113 | Perl_dump_op | |
114 | Perl_dump_packsubs | |
115 | Perl_dump_pm | |
116 | Perl_dump_sub | |
117 | Perl_expectterm | |
118 | Perl_fetch_gv | |
119 | Perl_fetch_io | |
120 | Perl_force_ident | |
121 | Perl_force_next | |
122 | Perl_force_word | |
123 | Perl_hv_stashpv | |
124 | Perl_intuit_more | |
d55594ae | 125 | Perl_init_thread_intern |
0a753a76 | 126 | Perl_know_next |
127 | Perl_modkids | |
128 | Perl_mstats | |
129 | Perl_my_bzero | |
130 | Perl_my_htonl | |
131 | Perl_my_ntohl | |
132 | Perl_my_swap | |
133 | Perl_my_chsize | |
134 | Perl_newXSUB | |
135 | Perl_no_fh_allowed | |
136 | Perl_no_op | |
137 | Perl_nointrp | |
138 | Perl_nomem | |
139 | Perl_pp_cswitch | |
140 | Perl_pp_entersubr | |
141 | Perl_pp_evalonce | |
142 | Perl_pp_interp | |
143 | Perl_pp_map | |
144 | Perl_pp_nswitch | |
145 | Perl_q | |
146 | Perl_reall_srchlen | |
0a753a76 | 147 | Perl_same_dirent |
148 | Perl_saw_return | |
149 | Perl_scan_const | |
150 | Perl_scan_formline | |
151 | Perl_scan_heredoc | |
152 | Perl_scan_ident | |
153 | Perl_scan_inputsymbol | |
154 | Perl_scan_pat | |
155 | Perl_scan_prefix | |
156 | Perl_scan_str | |
157 | Perl_scan_subst | |
158 | Perl_scan_trans | |
159 | Perl_scan_word | |
68dc0745 | 160 | Perl_setenv_getix |
0a753a76 | 161 | Perl_skipspace |
76e3520e | 162 | Perl_sort_mutex |
0a753a76 | 163 | Perl_sublex_done |
164 | Perl_sublex_start | |
0a753a76 | 165 | Perl_sv_ref |
166 | Perl_sv_setptrobj | |
0a753a76 | 167 | Perl_too_few_arguments |
168 | Perl_too_many_arguments | |
169 | Perl_unlnk | |
0a753a76 | 170 | Perl_watch |
171 | Perl_yyname | |
172 | Perl_yyrule | |
173 | allgvs | |
174 | curblock | |
0a753a76 | 175 | curcsv |
0a753a76 | 176 | lastretstr |
177 | mystack_mark | |
178 | perl_init_ext | |
179 | perl_requirepv | |
0a753a76 | 180 | stack |
0a753a76 | 181 | Perl_safexcalloc |
182 | Perl_safexmalloc | |
183 | Perl_safexfree | |
184 | Perl_safexrealloc | |
68dc0745 | 185 | Perl_my_memcmp |
8b10511d | 186 | Perl_my_memset |
db15561c | 187 | PL_cshlen |
188 | PL_cshname | |
189 | PL_opsave | |
22239a37 | 190 | )]; |
0a753a76 | 191 | |
c69f112c | 192 | |
bbc8f9de | 193 | if ($define{'MYMALLOC'}) |
194 | { | |
22239a37 | 195 | skip_symbols [qw( |
196 | Perl_safefree | |
197 | Perl_safemalloc | |
198 | Perl_saferealloc | |
199 | Perl_safecalloc)]; | |
200 | emit_symbols [qw( | |
201 | Perl_malloc | |
202 | Perl_free | |
203 | Perl_realloc | |
204 | Perl_calloc)]; | |
bbc8f9de | 205 | } |
32fcaa0b | 206 | else |
207 | { | |
208 | skip_symbols [qw( | |
209 | Perl_malloced_size)]; | |
210 | } | |
bbc8f9de | 211 | |
d55594ae | 212 | unless ($define{'USE_THREADS'}) |
213 | { | |
22239a37 | 214 | skip_symbols [qw( |
db15561c | 215 | PL_thr_key |
216 | PL_sv_mutex | |
46124e9e | 217 | PL_strtab_mutex |
db15561c | 218 | PL_svref_mutex |
219 | PL_malloc_mutex | |
5ff3f7a4 | 220 | PL_cred_mutex |
db15561c | 221 | PL_eval_mutex |
222 | PL_eval_cond | |
223 | PL_eval_owner | |
224 | PL_threads_mutex | |
225 | PL_nthreads | |
226 | PL_nthreads_cond | |
227 | PL_threadnum | |
228 | PL_threadsv_names | |
229 | PL_thrsv | |
230 | Perl_vtbl_mutex | |
eb480a0b | 231 | Perl_getTHR |
232 | Perl_setTHR | |
d55594ae | 233 | Perl_condpair_magic |
32f822de | 234 | Perl_new_struct_thread |
32f822de | 235 | Perl_per_thread_magicals |
d4cce5f1 | 236 | Perl_thread_create |
237 | Perl_find_threadsv | |
d55594ae | 238 | Perl_unlock_condpair |
d55594ae | 239 | Perl_magic_mutexfree |
95906810 | 240 | )]; |
910dfcc8 | 241 | } |
d4cce5f1 | 242 | |
910dfcc8 | 243 | unless ($define{'FAKE_THREADS'}) |
244 | { | |
db15561c | 245 | skip_symbols [qw(PL_curthr)]; |
d55594ae | 246 | } |
247 | ||
22239a37 | 248 | sub readvar |
249 | { | |
250 | my $file = shift; | |
251 | open(VARS,$file) || die "Cannot open $file:$!"; | |
252 | my @syms; | |
253 | while (<VARS>) | |
254 | { | |
255 | # All symbols have a Perl_ prefix because that's what embed.h | |
256 | # sticks in front of them. | |
db15561c | 257 | push(@syms,"PL_".$1) if (/\bPERLVARI?C?\([IGT](\w+)/); |
22239a37 | 258 | } |
259 | close(VARS); | |
260 | return \@syms; | |
261 | } | |
262 | ||
d4cce5f1 | 263 | if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'}) |
d55594ae | 264 | { |
22239a37 | 265 | my $thrd = readvar("../thrdvar.h"); |
266 | skip_symbols $thrd; | |
d55594ae | 267 | } |
268 | ||
d4cce5f1 | 269 | if ($define{'MULTIPLICITY'}) |
d55594ae | 270 | { |
22239a37 | 271 | my $interp = readvar("../intrpvar.h"); |
272 | skip_symbols $interp; | |
273 | } | |
274 | ||
275 | if ($define{'PERL_GLOBAL_STRUCT'}) | |
276 | { | |
277 | my $global = readvar("../perlvars.h"); | |
278 | skip_symbols $global; | |
852c2e52 | 279 | emit_symbols [qw(Perl_GetVars)]; |
db15561c | 280 | emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC'; |
d4cce5f1 | 281 | } |
d55594ae | 282 | |
36c15d3f | 283 | unless ($define{'DEBUGGING'}) |
284 | { | |
22239a37 | 285 | skip_symbols [qw( |
fea7140c | 286 | Perl_deb |
287 | Perl_deb_growlevel | |
288 | Perl_debop | |
289 | Perl_debprofdump | |
290 | Perl_debstack | |
291 | Perl_debstackptrs | |
22239a37 | 292 | Perl_runops_debug |
293 | Perl_sv_peek | |
294 | Perl_watchaddr | |
295 | Perl_watchok)]; | |
36c15d3f | 296 | } |
297 | ||
26618a56 | 298 | if ($define{'HAVE_DES_FCRYPT'}) |
299 | { | |
300 | emit_symbols [qw(win32_crypt)]; | |
301 | } | |
302 | ||
0a753a76 | 303 | open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!; |
22239a37 | 304 | while (<GLOBAL>) |
305 | { | |
306 | next if (!/^[A-Za-z]/); | |
307 | next if (/_amg[ \t]*$/); | |
308 | # All symbols have a Perl_ prefix because that's what embed.h | |
309 | # sticks in front of them. | |
310 | chomp($_); | |
311 | my $symbol = "Perl_$_"; | |
312 | emit_symbol($symbol) unless exists $skip{$symbol}; | |
313 | } | |
0a753a76 | 314 | close(GLOBAL); |
315 | ||
316 | # also add symbols from interp.sym | |
317 | # They are only needed if -DMULTIPLICITY is not set but it | |
318 | # doesn't hurt to include them anyway. | |
319 | # these don't have Perl prefix | |
320 | ||
852c2e52 | 321 | unless ($define{'PERL_GLOBAL_STRUCT'}) |
22239a37 | 322 | { |
323 | my $glob = readvar("../perlvars.h"); | |
324 | emit_symbols $glob; | |
325 | } | |
326 | ||
327 | unless ($define{'MULTIPLICITY'}) | |
328 | { | |
329 | my $glob = readvar("../intrpvar.h"); | |
330 | emit_symbols $glob; | |
331 | } | |
0a753a76 | 332 | |
22239a37 | 333 | unless ($define{'MULTIPLICITY'} || $define{'USE_THREADS'}) |
334 | { | |
335 | my $glob = readvar("../thrdvar.h"); | |
336 | emit_symbols $glob; | |
337 | } | |
0a753a76 | 338 | |
339 | while (<DATA>) { | |
340 | my $symbol; | |
341 | next if (!/^[A-Za-z]/); | |
342 | next if (/^#/); | |
a868473f | 343 | s/\r//g; |
22239a37 | 344 | chomp($_); |
0a753a76 | 345 | $symbol = $_; |
22239a37 | 346 | next if exists $skip{$symbol}; |
3e3baf6d | 347 | emit_symbol($symbol); |
348 | } | |
349 | ||
22239a37 | 350 | foreach my $symbol (sort keys %export) |
351 | { | |
ac4c12e7 | 352 | output_symbol($symbol); |
22239a37 | 353 | } |
354 | ||
355 | sub emit_symbol { | |
356 | my $symbol = shift; | |
357 | chomp($symbol); | |
358 | $export{$symbol} = 1; | |
3e3baf6d | 359 | } |
0a753a76 | 360 | |
ac4c12e7 | 361 | sub output_symbol { |
362 | my $symbol = shift; | |
363 | if ($CCTYPE eq "BORLAND") { | |
364 | # workaround Borland quirk by exporting both the straight | |
365 | # name and a name with leading underscore. Note the | |
366 | # alias *must* come after the symbol itself, if both | |
367 | # are to be exported. (Linker bug?) | |
368 | print "\t_$symbol\n"; | |
369 | print "\t$symbol = _$symbol\n"; | |
370 | } | |
371 | elsif ($CCTYPE eq 'GCC') { | |
372 | # Symbols have leading _ whole process is $%£"% slow | |
373 | # so skip aliases for now | |
374 | print "\t$symbol\n"; | |
375 | } | |
376 | else { | |
377 | # for binary coexistence, export both the symbol and | |
378 | # alias with leading underscore | |
379 | print "\t$symbol\n"; | |
380 | print "\t_$symbol = $symbol\n"; | |
381 | } | |
382 | } | |
383 | ||
0a753a76 | 384 | 1; |
385 | __DATA__ | |
386 | # extra globals not included above. | |
387 | perl_init_i18nl10n | |
388 | perl_init_ext | |
389 | perl_alloc | |
4b556e6c | 390 | perl_atexit |
0a753a76 | 391 | perl_construct |
392 | perl_destruct | |
393 | perl_free | |
394 | perl_parse | |
395 | perl_run | |
396 | perl_get_sv | |
397 | perl_get_av | |
398 | perl_get_hv | |
399 | perl_get_cv | |
400 | perl_call_argv | |
401 | perl_call_pv | |
402 | perl_call_method | |
403 | perl_call_sv | |
10dd38fc | 404 | perl_require_pv |
405 | perl_eval_pv | |
406 | perl_eval_sv | |
6dead956 | 407 | perl_new_ctype |
408 | perl_new_collate | |
409 | perl_new_numeric | |
410 | perl_set_numeric_standard | |
411 | perl_set_numeric_local | |
d28b3ca3 | 412 | boot_DynaLoader |
d55594ae | 413 | Perl_thread_create |
68dc0745 | 414 | win32_errno |
96e4d5b1 | 415 | win32_environ |
68dc0745 | 416 | win32_stdin |
417 | win32_stdout | |
96e4d5b1 | 418 | win32_stderr |
68dc0745 | 419 | win32_ferror |
420 | win32_feof | |
421 | win32_strerror | |
422 | win32_fprintf | |
423 | win32_printf | |
424 | win32_vfprintf | |
96e4d5b1 | 425 | win32_vprintf |
68dc0745 | 426 | win32_fread |
427 | win32_fwrite | |
428 | win32_fopen | |
429 | win32_fdopen | |
430 | win32_freopen | |
431 | win32_fclose | |
432 | win32_fputs | |
433 | win32_fputc | |
434 | win32_ungetc | |
435 | win32_getc | |
436 | win32_fileno | |
437 | win32_clearerr | |
438 | win32_fflush | |
439 | win32_ftell | |
440 | win32_fseek | |
441 | win32_fgetpos | |
442 | win32_fsetpos | |
443 | win32_rewind | |
444 | win32_tmpfile | |
445 | win32_abort | |
446 | win32_fstat | |
96e4d5b1 | 447 | win32_stat |
68dc0745 | 448 | win32_pipe |
449 | win32_popen | |
450 | win32_pclose | |
e24c7c18 | 451 | win32_rename |
68dc0745 | 452 | win32_setmode |
96e4d5b1 | 453 | win32_lseek |
454 | win32_tell | |
68dc0745 | 455 | win32_dup |
456 | win32_dup2 | |
96e4d5b1 | 457 | win32_open |
458 | win32_close | |
459 | win32_eof | |
68dc0745 | 460 | win32_read |
461 | win32_write | |
3e3baf6d | 462 | win32_spawnvp |
5aabfad6 | 463 | win32_mkdir |
464 | win32_rmdir | |
465 | win32_chdir | |
c90c0ff4 | 466 | win32_flock |
eb62e965 | 467 | win32_execv |
6890e559 | 468 | win32_execvp |
54310121 | 469 | win32_htons |
470 | win32_ntohs | |
471 | win32_htonl | |
472 | win32_ntohl | |
473 | win32_inet_addr | |
474 | win32_inet_ntoa | |
475 | win32_socket | |
476 | win32_bind | |
477 | win32_listen | |
478 | win32_accept | |
479 | win32_connect | |
480 | win32_send | |
481 | win32_sendto | |
482 | win32_recv | |
483 | win32_recvfrom | |
484 | win32_shutdown | |
3a25acb4 | 485 | win32_closesocket |
54310121 | 486 | win32_ioctlsocket |
487 | win32_setsockopt | |
488 | win32_getsockopt | |
489 | win32_getpeername | |
490 | win32_getsockname | |
491 | win32_gethostname | |
492 | win32_gethostbyname | |
493 | win32_gethostbyaddr | |
494 | win32_getprotobyname | |
495 | win32_getprotobynumber | |
496 | win32_getservbyname | |
497 | win32_getservbyport | |
498 | win32_select | |
499 | win32_endhostent | |
500 | win32_endnetent | |
501 | win32_endprotoent | |
502 | win32_endservent | |
503 | win32_getnetent | |
504 | win32_getnetbyname | |
505 | win32_getnetbyaddr | |
506 | win32_getprotoent | |
507 | win32_getservent | |
508 | win32_sethostent | |
509 | win32_setnetent | |
510 | win32_setprotoent | |
511 | win32_setservent | |
ad2e33dc | 512 | win32_getenv |
84902520 | 513 | win32_perror |
514 | win32_setbuf | |
515 | win32_setvbuf | |
516 | win32_flushall | |
517 | win32_fcloseall | |
518 | win32_fgets | |
519 | win32_gets | |
520 | win32_fgetc | |
521 | win32_putc | |
522 | win32_puts | |
523 | win32_getchar | |
524 | win32_putchar | |
525 | win32_malloc | |
526 | win32_calloc | |
527 | win32_realloc | |
528 | win32_free | |
f3986ebb | 529 | win32_sleep |
530 | win32_times | |
531 | win32_alarm | |
65e48ea9 | 532 | win32_open_osfhandle |
533 | win32_get_osfhandle | |
f998180f | 534 | win32_ioctl |
ad0751ec | 535 | win32_utime |
22fae026 | 536 | win32_wait |
f55ee38a | 537 | win32_waitpid |
538 | win32_kill | |
22fae026 | 539 | win32_str_os_error |
ce2e26e5 | 540 | win32_opendir |
541 | win32_readdir | |
542 | win32_telldir | |
543 | win32_seekdir | |
544 | win32_rewinddir | |
545 | win32_closedir | |
ad2e33dc | 546 | Perl_win32_init |
f3986ebb | 547 | Perl_init_os_extras |
9811a7d7 | 548 | Perl_getTHR |
0fefa03b | 549 | Perl_setTHR |
84902520 | 550 | RunPerl |
22239a37 | 551 |