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