This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
attributes-two.patch also contains a lot of const-ing, hence the
[perl5.git] / makedef.pl
CommitLineData
549a6b10
JH
1#
2# Create the export list for perl.
3#
86593e8d
JH
4# Needed by WIN32 and OS/2 for creating perl.dll,
5# and by AIX for creating libperl.a when -Dusershrplib is in effect,
6# and by MacOS Classic.
549a6b10 7#
22c35a8c 8# reads global.sym, pp.sym, perlvars.h, intrpvar.h, thrdvar.h, config.h
8257dec7 9# On OS/2 reads miniperl.map and the previous version of perl5.def as well
0a753a76 10
549a6b10
JH
11my $PLATFORM;
12my $CCTYPE;
910dfcc8 13
7766f137
GS
14while (@ARGV) {
15 my $flag = shift;
8257dec7
IZ
16 if ($flag =~ s/^CC_FLAGS=/ /) {
17 for my $fflag ($flag =~ /(?:^|\s)-D(\S+)/g) {
18 $fflag .= '=1' unless $fflag =~ /^(\w+)=/;
19 $define{$1} = $2 if $fflag =~ /^(\w+)=(.+)$/;
20 }
21 next;
22 }
7766f137
GS
23 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
24 $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
25 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
26 $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
18f68570
VK
27 if ($PLATFORM eq 'netware') {
28 $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
29 }
7766f137 30}
d55594ae 31
18f68570 32my @PLATFORM = qw(aix win32 wince os2 MacOS netware);
549a6b10
JH
33my %PLATFORM;
34@PLATFORM{@PLATFORM} = ();
35
36defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
9df9a5cd 37exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
549a6b10 38
c6261f3b
JH
39my %exportperlmalloc =
40 (
41 Perl_malloc => "malloc",
42 Perl_mfree => "free",
43 Perl_realloc => "realloc",
44 Perl_calloc => "calloc",
45 );
46
47my $exportperlmalloc = $PLATFORM eq 'os2';
48
549a6b10
JH
49my $config_sh = "config.sh";
50my $config_h = "config.h";
51my $thrdvar_h = "thrdvar.h";
52my $intrpvar_h = "intrpvar.h";
53my $perlvars_h = "perlvars.h";
54my $global_sym = "global.sym";
55my $pp_sym = "pp.sym";
56my $globvar_sym = "globvar.sym";
57my $perlio_sym = "perlio.sym";
5991d125 58my $static_ext = "";
549a6b10 59
9df9a5cd 60if ($PLATFORM eq 'aix') {
549a6b10 61 # Nothing for now.
7766f137 62}
18f68570 63elsif ($PLATFORM =~ /^win(?:32|ce)$/ || $PLATFORM eq 'netware') {
549a6b10 64 $CCTYPE = "MSVC" unless defined $CCTYPE;
00b02797
JH
65 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
66 $pp_sym, $globvar_sym, $perlio_sym) {
549a6b10
JH
67 s!^!..\\!;
68 }
69}
084592ab
CN
70elsif ($PLATFORM eq 'MacOS') {
71 foreach ($thrdvar_h, $intrpvar_h, $perlvars_h, $global_sym,
72 $pp_sym, $globvar_sym, $perlio_sym) {
73 s!^!::!;
74 }
75}
549a6b10 76
18f68570 77unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'MacOS' || $PLATFORM eq 'netware') {
549a6b10 78 open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
7766f137 79 while (<CFG>) {
549a6b10
JH
80 if (/^(?:ccflags|optimize)='(.+)'$/) {
81 $_ = $1;
82 $define{$1} = 1 while /-D(\w+)/g;
83 }
3cfae81b 84 if ($PLATFORM eq 'os2') {
52e4c282
IZ
85 $CONFIG_ARGS = $1 if /^config_args='(.+)'$/;
86 $ARCHNAME = $1 if /^archname='(.+)'$/;
87 $PATCHLEVEL = $1 if /^perl_patchlevel='(.+)'$/;
3cfae81b 88 }
549a6b10
JH
89 }
90 close(CFG);
91}
5991d125
NC
92if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
93 open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n";
94 if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
95 $static_ext = $1;
96 }
97 close(CFG);
98}
549a6b10
JH
99
100open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
7766f137
GS
101while (<CFG>) {
102 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
7766f137 103 $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
0e32cd81
JH
104 $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
105 $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
7766f137 106}
bbc8f9de
NIS
107close(CFG);
108
18c4b137
JH
109# perl.h logic duplication begins
110
f4a6c1f7
JH
111if ($define{PERL_IMPLICIT_SYS}) {
112 $define{PL_OP_SLAB_ALLOC} = 1;
113}
ac6bedea 114
18c4b137 115if ($define{USE_ITHREADS}) {
acfe0abc 116 if (!$define{MULTIPLICITY}) {
18c4b137
JH
117 $define{MULTIPLICITY} = 1;
118 }
119}
120
121$define{PERL_IMPLICIT_CONTEXT} ||=
122 $define{USE_ITHREADS} ||
66cf6f75 123 $define{USE_5005THREADS} ||
18c4b137
JH
124 $define{MULTIPLICITY} ;
125
10bc17b6
JH
126if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
127 $define{USE_REENTRANT_API} = 1;
128}
129
18c4b137
JH
130# perl.h logic duplication ends
131
ac6bedea
JH
132my $sym_ord = 0;
133
18f68570 134if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 135 warn join(' ',keys %define)."\n";
18f68570
VK
136 ($dll = ($define{PERL_DLL} || "perl58")) =~ s/\.dll$//i;
137 print "LIBRARY $dll\n";
dfdd1393
GS
138 print "DESCRIPTION 'Perl interpreter'\n";
139 print "EXPORTS\n";
140 if ($define{PERL_IMPLICIT_SYS}) {
549a6b10 141 output_symbol("perl_get_host_info");
7766f137 142 output_symbol("perl_alloc_override");
0295eab8 143 }
b54a2e1e 144 if ($define{USE_ITHREADS} and $define{PERL_IMPLICIT_SYS}) {
ac6bedea 145 output_symbol("perl_clone_host");
51371543 146 }
7766f137
GS
147}
148elsif ($PLATFORM eq 'os2') {
52e4c282
IZ
149 if (open my $fh, '<', 'perl5.def') {
150 while (<$fh>) {
151 last if /^\s*EXPORTS\b/;
152 }
153 while (<$fh>) {
78232bc0 154 $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
52e4c282
IZ
155 # This allows skipping ordinals which were used in older versions
156 $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
157 }
158 $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
159 }
3cfae81b
IZ
160 ($v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
161 $v .= '-thread' if $ARCHNAME =~ /-thread/;
3cfae81b 162 ($dll = $define{PERL_DLL}) =~ s/\.dll$//i;
52e4c282 163 $v .= "\@$PATCHLEVEL" if $PATCHLEVEL;
1102eebe
IZ
164 $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'";
165 $d = substr($d, 0, 249) . "...'" if length $d > 253;
3cfae81b
IZ
166 print <<"---EOP---";
167LIBRARY '$dll' INITINSTANCE TERMINSTANCE
1102eebe 168$d
3cfae81b
IZ
169STACKSIZE 32768
170CODE LOADONCALL
171DATA LOADONCALL NONSHARED MULTIPLE
172EXPORTS
173---EOP---
7766f137
GS
174}
175elsif ($PLATFORM eq 'aix') {
61d42ce4
JH
176 $OSVER = `uname -v`;
177 chop $OSVER;
178 $OSREL = `uname -r`;
179 chop $OSREL;
180 if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
181 print "#! ..\n";
182 } else {
183 print "#!\n";
184 }
ac4c12e7 185}
2986a63f
JH
186elsif ($PLATFORM eq 'netware') {
187 if ($FILETYPE eq 'def') {
9c25e1f8 188 print "LIBRARY perl58\n";
2986a63f
JH
189 print "DESCRIPTION 'Perl interpreter for NetWare'\n";
190 print "EXPORTS\n";
191 }
192 if ($define{PERL_IMPLICIT_SYS}) {
ac6bedea
JH
193 output_symbol("perl_get_host_info");
194 output_symbol("perl_alloc_override");
195 output_symbol("perl_clone_host");
2986a63f
JH
196 }
197}
bbc8f9de 198
22239a37
NIS
199my %skip;
200my %export;
201
51371543
GS
202sub skip_symbols {
203 my $list = shift;
204 foreach my $symbol (@$list) {
205 $skip{$symbol} = 1;
206 }
22239a37
NIS
207}
208
51371543
GS
209sub emit_symbols {
210 my $list = shift;
211 foreach my $symbol (@$list) {
212 my $skipsym = $symbol;
213 # XXX hack
acfe0abc 214 if ($define{MULTIPLICITY}) {
51371543
GS
215 $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
216 }
217 emit_symbol($symbol) unless exists $skip{$skipsym};
218 }
22239a37
NIS
219}
220
549a6b10 221if ($PLATFORM eq 'win32') {
7766f137
GS
222 skip_symbols [qw(
223 PL_statusvalue_vms
224 PL_archpat_auto
225 PL_cryptseen
226 PL_DBcv
227 PL_generation
228 PL_lastgotoprobe
229 PL_linestart
230 PL_modcount
231 PL_pending_ident
232 PL_sortcxix
233 PL_sublex_info
234 PL_timesbuf
235 main
236 Perl_ErrorNo
237 Perl_GetVars
238 Perl_do_exec3
239 Perl_do_ipcctl
240 Perl_do_ipcget
241 Perl_do_msgrcv
242 Perl_do_msgsnd
243 Perl_do_semop
244 Perl_do_shmio
245 Perl_dump_fds
246 Perl_init_thread_intern
247 Perl_my_bzero
9d50d399 248 Perl_my_bcopy
7766f137
GS
249 Perl_my_htonl
250 Perl_my_ntohl
251 Perl_my_swap
252 Perl_my_chsize
253 Perl_same_dirent
254 Perl_setenv_getix
255 Perl_unlnk
256 Perl_watch
257 Perl_safexcalloc
258 Perl_safexmalloc
259 Perl_safexfree
260 Perl_safexrealloc
261 Perl_my_memcmp
262 Perl_my_memset
263 PL_cshlen
264 PL_cshname
265 PL_opsave
266 Perl_do_exec
267 Perl_getenv_len
268 Perl_my_pclose
269 Perl_my_popen
270 )];
271}
54725af6
GS
272else {
273 skip_symbols [qw(
274 Perl_do_spawn
275 Perl_do_spawn_nowait
276 Perl_do_aspawn
277 )];
278}
279if ($PLATFORM eq 'wince') {
18f68570
VK
280 skip_symbols [qw(
281 PL_statusvalue_vms
282 PL_archpat_auto
283 PL_cryptseen
284 PL_DBcv
285 PL_generation
286 PL_lastgotoprobe
287 PL_linestart
288 PL_modcount
289 PL_pending_ident
290 PL_sortcxix
291 PL_sublex_info
292 PL_timesbuf
293 PL_collation_ix
294 PL_collation_name
295 PL_collation_standard
296 PL_collxfrm_base
297 PL_collxfrm_mult
298 PL_numeric_compat1
299 PL_numeric_local
300 PL_numeric_name
301 PL_numeric_radix_sv
302 PL_numeric_standard
303 PL_vtbl_collxfrm
304 Perl_sv_collxfrm
305 setgid
306 setuid
18f68570
VK
307 win32_free_childdir
308 win32_free_childenv
309 win32_get_childdir
310 win32_get_childenv
311 win32_spawnvp
312 main
313 Perl_ErrorNo
314 Perl_GetVars
315 Perl_do_exec3
316 Perl_do_ipcctl
317 Perl_do_ipcget
318 Perl_do_msgrcv
319 Perl_do_msgsnd
320 Perl_do_semop
321 Perl_do_shmio
322 Perl_dump_fds
323 Perl_init_thread_intern
324 Perl_my_bzero
325 Perl_my_bcopy
326 Perl_my_htonl
327 Perl_my_ntohl
328 Perl_my_swap
329 Perl_my_chsize
330 Perl_same_dirent
331 Perl_setenv_getix
332 Perl_unlnk
333 Perl_watch
334 Perl_safexcalloc
335 Perl_safexmalloc
336 Perl_safexfree
337 Perl_safexrealloc
338 Perl_my_memcmp
339 Perl_my_memset
340 PL_cshlen
341 PL_cshname
342 PL_opsave
343 Perl_do_exec
344 Perl_getenv_len
345 Perl_my_pclose
346 Perl_my_popen
347 )];
348}
7766f137 349elsif ($PLATFORM eq 'aix') {
549a6b10 350 skip_symbols([qw(
7766f137
GS
351 Perl_dump_fds
352 Perl_ErrorNo
353 Perl_GetVars
354 Perl_my_bcopy
355 Perl_my_bzero
356 Perl_my_chsize
357 Perl_my_htonl
358 Perl_my_memcmp
359 Perl_my_memset
360 Perl_my_ntohl
361 Perl_my_swap
362 Perl_safexcalloc
363 Perl_safexfree
364 Perl_safexmalloc
365 Perl_safexrealloc
366 Perl_same_dirent
367 Perl_unlnk
6c644e78 368 Perl_sys_intern_clear
95151ede 369 Perl_sys_intern_dup
52853b95 370 Perl_sys_intern_init
7766f137
GS
371 PL_cryptseen
372 PL_opsave
373 PL_statusvalue_vms
374 PL_sys_intern
375 )]);
376}
377elsif ($PLATFORM eq 'os2') {
3cfae81b 378 emit_symbols([qw(
7766f137
GS
379 ctermid
380 get_sysinfo
381 Perl_OS2_init
764df951
IZ
382 Perl_OS2_init3
383 Perl_OS2_term
7766f137
GS
384 OS2_Perl_data
385 dlopen
386 dlsym
387 dlerror
403d6f8e 388 dlclose
17999b1c
IZ
389 dup2
390 dup
7766f137
GS
391 my_tmpfile
392 my_tmpnam
393 my_flock
9c130f5b
NIS
394 my_rmdir
395 my_mkdir
f72c975a
IZ
396 my_getpwuid
397 my_getpwnam
398 my_getpwent
399 my_setpwent
400 my_endpwent
18729d3e
JH
401 fork_with_resources
402 croak_with_os2error
f72c975a
IZ
403 setgrent
404 endgrent
405 getgrent
7766f137
GS
406 malloc_mutex
407 threads_mutex
408 nthreads
409 nthreads_cond
410 os2_cond_wait
411 os2_stat
133fa74f
IZ
412 os2_execname
413 async_mssleep
414 msCounter
415 InfoTable
7766f137
GS
416 pthread_join
417 pthread_create
418 pthread_detach
419 XS_Cwd_change_drive
420 XS_Cwd_current_drive
421 XS_Cwd_extLibpath
422 XS_Cwd_extLibpath_set
423 XS_Cwd_sys_abspath
424 XS_Cwd_sys_chdir
425 XS_Cwd_sys_cwd
426 XS_Cwd_sys_is_absolute
427 XS_Cwd_sys_is_relative
428 XS_Cwd_sys_is_rooted
429 XS_DynaLoader_mod2fname
430 XS_File__Copy_syscopy
431 Perl_Register_MQ
432 Perl_Deregister_MQ
433 Perl_Serve_Messages
434 Perl_Process_Messages
435 init_PMWIN_entries
436 PMWIN_entries
437 Perl_hab_GET
35bc1fdc
IZ
438 loadByOrdinal
439 pExtFCN
30500b05
IZ
440 os2error
441 ResetWinError
442 CroakWinError
8257dec7 443 PL_do_undump
7766f137 444 )]);
8257dec7
IZ
445 emit_symbols([qw(os2_cond_wait
446 pthread_join
447 pthread_create
448 pthread_detach
449 )])
450 if $define{'USE_5005THREADS'} or $define{'USE_ITHREADS'};
3cfae81b 451}
084592ab
CN
452elsif ($PLATFORM eq 'MacOS') {
453 skip_symbols [qw(
454 Perl_GetVars
455 PL_cryptseen
456 PL_cshlen
457 PL_cshname
458 PL_statusvalue_vms
459 PL_sys_intern
460 PL_opsave
461 PL_timesbuf
462 Perl_dump_fds
463 Perl_my_bcopy
464 Perl_my_bzero
465 Perl_my_chsize
466 Perl_my_htonl
467 Perl_my_memcmp
468 Perl_my_memset
469 Perl_my_ntohl
470 Perl_my_swap
471 Perl_safexcalloc
472 Perl_safexfree
473 Perl_safexmalloc
474 Perl_safexrealloc
475 Perl_unlnk
fe05f414
JH
476 Perl_sys_intern_clear
477 Perl_sys_intern_init
084592ab
CN
478 )];
479}
2986a63f
JH
480elsif ($PLATFORM eq 'netware') {
481 skip_symbols [qw(
482 PL_statusvalue_vms
483 PL_archpat_auto
484 PL_cryptseen
485 PL_DBcv
486 PL_generation
487 PL_lastgotoprobe
488 PL_linestart
489 PL_modcount
490 PL_pending_ident
491 PL_sortcxix
492 PL_sublex_info
493 PL_timesbuf
494 main
495 Perl_ErrorNo
496 Perl_GetVars
497 Perl_do_exec3
498 Perl_do_ipcctl
499 Perl_do_ipcget
500 Perl_do_msgrcv
501 Perl_do_msgsnd
502 Perl_do_semop
503 Perl_do_shmio
504 Perl_dump_fds
505 Perl_init_thread_intern
506 Perl_my_bzero
507 Perl_my_htonl
508 Perl_my_ntohl
509 Perl_my_swap
510 Perl_my_chsize
511 Perl_same_dirent
512 Perl_setenv_getix
513 Perl_unlnk
514 Perl_watch
515 Perl_safexcalloc
516 Perl_safexmalloc
517 Perl_safexfree
518 Perl_safexrealloc
519 Perl_my_memcmp
520 Perl_my_memset
521 PL_cshlen
522 PL_cshname
523 PL_opsave
524 Perl_do_exec
525 Perl_getenv_len
526 Perl_my_pclose
527 Perl_my_popen
011f1a1a
JH
528 Perl_sys_intern_init
529 Perl_sys_intern_dup
530 Perl_sys_intern_clear
531 Perl_my_bcopy
532 Perl_PerlIO_write
533 Perl_PerlIO_unread
534 Perl_PerlIO_tell
535 Perl_PerlIO_stdout
536 Perl_PerlIO_stdin
537 Perl_PerlIO_stderr
538 Perl_PerlIO_setlinebuf
539 Perl_PerlIO_set_ptrcnt
540 Perl_PerlIO_set_cnt
541 Perl_PerlIO_seek
542 Perl_PerlIO_read
543 Perl_PerlIO_get_ptr
544 Perl_PerlIO_get_cnt
545 Perl_PerlIO_get_bufsiz
546 Perl_PerlIO_get_base
547 Perl_PerlIO_flush
548 Perl_PerlIO_fill
549 Perl_PerlIO_fileno
550 Perl_PerlIO_error
551 Perl_PerlIO_eof
552 Perl_PerlIO_close
553 Perl_PerlIO_clearerr
554 PerlIO_perlio
2986a63f
JH
555 )];
556}
3cfae81b 557
7766f137
GS
558unless ($define{'DEBUGGING'}) {
559 skip_symbols [qw(
7766f137
GS
560 Perl_deb_growlevel
561 Perl_debop
562 Perl_debprofdump
563 Perl_debstack
564 Perl_debstackptrs
7766f137
GS
565 Perl_sv_peek
566 PL_block_type
567 PL_watchaddr
568 PL_watchok
569 )];
570}
571
572if ($define{'PERL_IMPLICIT_SYS'}) {
573 skip_symbols [qw(
574 Perl_getenv_len
575 Perl_my_popen
576 Perl_my_pclose
577 )];
578}
579else {
580 skip_symbols [qw(
581 PL_Mem
582 PL_MemShared
583 PL_MemParse
584 PL_Env
585 PL_StdIO
586 PL_LIO
587 PL_Dir
588 PL_Sock
589 PL_Proc
590 )];
591}
592
7c128300
GS
593unless ($define{'PERL_FLEXIBLE_EXCEPTIONS'}) {
594 skip_symbols [qw(
595 PL_protect
596 Perl_default_protect
597 Perl_vdefault_protect
598 )];
599}
600
5bcb3f6c
NIS
601unless ($define{'USE_REENTRANT_API'}) {
602 skip_symbols [qw(
603 PL_reentrant_buffer
604 )];
605}
606
7766f137
GS
607if ($define{'MYMALLOC'}) {
608 emit_symbols [qw(
609 Perl_dump_mstats
827e134a 610 Perl_get_mstats
9c130f5b
NIS
611 Perl_strdup
612 Perl_putenv
ac388100
JH
613 MallocCfg_ptr
614 MallocCfgP_ptr
7766f137 615 )];
bbda9c9d 616 if ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
1feb2720
GS
617 emit_symbols [qw(
618 PL_malloc_mutex
619 )];
620 }
80fc1a6e
GS
621 else {
622 skip_symbols [qw(
623 PL_malloc_mutex
624 )];
625 }
51371543
GS
626}
627else {
7766f137
GS
628 skip_symbols [qw(
629 PL_malloc_mutex
630 Perl_dump_mstats
6ecd3fcb 631 Perl_get_mstats
7766f137 632 Perl_malloced_size
ac388100
JH
633 MallocCfg_ptr
634 MallocCfgP_ptr
7766f137
GS
635 )];
636}
637
1c6118a4
JH
638if ($define{'PERL_MALLOC_WRAP'}) {
639 emit_symbols [qw(
640 PL_memory_wrap
641 )];
642}
643
f433d095 644unless ($define{'USE_5005THREADS'} || $define{'USE_ITHREADS'}) {
7766f137
GS
645 skip_symbols [qw(
646 PL_thr_key
f433d095
GS
647 )];
648}
649
650unless ($define{'USE_5005THREADS'}) {
651 skip_symbols [qw(
7766f137
GS
652 PL_sv_mutex
653 PL_strtab_mutex
654 PL_svref_mutex
7766f137
GS
655 PL_cred_mutex
656 PL_eval_mutex
6940069f
GS
657 PL_fdpid_mutex
658 PL_sv_lock_mutex
7766f137
GS
659 PL_eval_cond
660 PL_eval_owner
661 PL_threads_mutex
662 PL_nthreads
663 PL_nthreads_cond
664 PL_threadnum
665 PL_threadsv_names
666 PL_thrsv
667 PL_vtbl_mutex
7766f137
GS
668 Perl_condpair_magic
669 Perl_new_struct_thread
670 Perl_per_thread_magicals
671 Perl_thread_create
672 Perl_find_threadsv
673 Perl_unlock_condpair
674 Perl_magic_mutexfree
4755096e 675 Perl_sv_lock
7766f137
GS
676 )];
677}
678
679unless ($define{'USE_ITHREADS'}) {
680 skip_symbols [qw(
681 PL_ptr_table
1134a1d6
NC
682 PL_pte_root
683 PL_pte_arenaroot
534825c4 684 PL_op_mutex
7e95b20d
JH
685 PL_regex_pad
686 PL_regex_padav
f2f7cecd
MB
687 PL_sharedsv_space
688 PL_sharedsv_space_mutex
7223e9d8 689 PL_dollarzero_mutex
7766f137
GS
690 Perl_dirp_dup
691 Perl_cx_dup
692 Perl_si_dup
693 Perl_any_dup
694 Perl_ss_dup
695 Perl_fp_dup
696 Perl_gp_dup
697 Perl_he_dup
698 Perl_mg_dup
699 Perl_re_dup
700 Perl_sv_dup
c501bbfe 701 Perl_rvpv_dup
7766f137 702 Perl_sys_intern_dup
86593e8d 703 Perl_ptr_table_clear
7766f137 704 Perl_ptr_table_fetch
86593e8d 705 Perl_ptr_table_free
7766f137 706 Perl_ptr_table_new
4ac9195f
MS
707 Perl_ptr_table_clear
708 Perl_ptr_table_free
7766f137
GS
709 Perl_ptr_table_split
710 Perl_ptr_table_store
711 perl_clone
712 perl_clone_using
038f0558
JH
713 Perl_sharedsv_find
714 Perl_sharedsv_init
715 Perl_sharedsv_lock
716 Perl_sharedsv_new
717 Perl_sharedsv_thrcnt_dec
718 Perl_sharedsv_thrcnt_inc
719 Perl_sharedsv_unlock
7766f137
GS
720 )];
721}
722
723unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
724 skip_symbols [qw(
725 Perl_croak_nocontext
726 Perl_die_nocontext
727 Perl_deb_nocontext
728 Perl_form_nocontext
e0f4245d 729 Perl_load_module_nocontext
7766f137
GS
730 Perl_mess_nocontext
731 Perl_warn_nocontext
732 Perl_warner_nocontext
733 Perl_newSVpvf_nocontext
734 Perl_sv_catpvf_nocontext
735 Perl_sv_setpvf_nocontext
736 Perl_sv_catpvf_mg_nocontext
737 Perl_sv_setpvf_mg_nocontext
738 )];
739}
740
741unless ($define{'PERL_IMPLICIT_SYS'}) {
742 skip_symbols [qw(
743 perl_alloc_using
014822e4 744 perl_clone_using
7766f137
GS
745 )];
746}
747
748unless ($define{'FAKE_THREADS'}) {
749 skip_symbols [qw(PL_curthr)];
750}
751
ac6bedea
JH
752unless ($define{'PL_OP_SLAB_ALLOC'}) {
753 skip_symbols [qw(
754 PL_OpPtr
755 PL_OpSlab
756 PL_OpSpace
f4a6c1f7
JH
757 Perl_Slab_Alloc
758 Perl_Slab_Free
ac6bedea
JH
759 )];
760}
761
5b7ea690
JH
762unless ($define{'THREADS_HAVE_PIDS'}) {
763 skip_symbols [qw(PL_ppid)];
764}
765
7766f137
GS
766sub readvar {
767 my $file = shift;
768 my $proc = shift || sub { "PL_$_[2]" };
769 open(VARS,$file) || die "Cannot open $file: $!\n";
770 my @syms;
771 while (<VARS>) {
772 # All symbols have a Perl_ prefix because that's what embed.h
773 # sticks in front of them.
774 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
9df9a5cd
NIS
775 }
776 close(VARS);
7766f137
GS
777 return \@syms;
778}
779
6f4183fe 780if ($define{'USE_5005THREADS'}) {
7766f137
GS
781 my $thrd = readvar($thrdvar_h);
782 skip_symbols $thrd;
783}
784
7766f137
GS
785if ($define{'PERL_GLOBAL_STRUCT'}) {
786 my $global = readvar($perlvars_h);
787 skip_symbols $global;
788 emit_symbol('Perl_GetVars');
789 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
790}
36c15d3f 791
22c35a8c
GS
792# functions from *.sym files
793
954c1994 794my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
549a6b10 795
d892637e
NIS
796# Symbols that are the public face of the PerlIO layers implementation
797# These are in _addition to_ the public face of the abstraction
798# and need to be exported to allow XS modules to implement layers
9df9a5cd 799my @layer_syms = qw(
64aa19bc
JH
800 PerlIOBase_binmode
801 PerlIOBase_clearerr
802 PerlIOBase_close
803 PerlIOBase_dup
804 PerlIOBase_eof
805 PerlIOBase_error
806 PerlIOBase_fileno
807 PerlIOBase_noop_fail
808 PerlIOBase_noop_ok
809 PerlIOBase_popped
cc5c63cd 810 PerlIOBase_pushed
64aa19bc
JH
811 PerlIOBase_read
812 PerlIOBase_setlinebuf
813 PerlIOBase_unread
814 PerlIOBuf_bufsiz
815 PerlIOBuf_close
816 PerlIOBuf_dup
817 PerlIOBuf_fill
818 PerlIOBuf_flush
819 PerlIOBuf_get_base
820 PerlIOBuf_get_cnt
821 PerlIOBuf_get_ptr
822 PerlIOBuf_open
823 PerlIOBuf_popped
824 PerlIOBuf_pushed
825 PerlIOBuf_read
826 PerlIOBuf_seek
827 PerlIOBuf_set_ptrcnt
828 PerlIOBuf_tell
829 PerlIOBuf_unread
830 PerlIOBuf_write
831 PerlIO_allocate
cc5c63cd 832 PerlIO_apply_layera
64aa19bc
JH
833 PerlIO_apply_layers
834 PerlIO_arg_fetch
835 PerlIO_debug
836 PerlIO_define_layer
ac388100 837 PerlIO_isutf8
64aa19bc
JH
838 PerlIO_layer_fetch
839 PerlIO_list_free
840 PerlIO_modestr
841 PerlIO_parse_layers
842 PerlIO_pending
843 PerlIO_perlio
844 PerlIO_pop
845 PerlIO_push
846 PerlIO_sv_dup
847 Perl_PerlIO_clearerr
848 Perl_PerlIO_close
849 Perl_PerlIO_eof
850 Perl_PerlIO_error
851 Perl_PerlIO_fileno
852 Perl_PerlIO_fill
853 Perl_PerlIO_flush
854 Perl_PerlIO_get_base
855 Perl_PerlIO_get_bufsiz
856 Perl_PerlIO_get_cnt
857 Perl_PerlIO_get_ptr
858 Perl_PerlIO_read
859 Perl_PerlIO_seek
860 Perl_PerlIO_set_cnt
861 Perl_PerlIO_set_ptrcnt
862 Perl_PerlIO_setlinebuf
863 Perl_PerlIO_stderr
864 Perl_PerlIO_stdin
865 Perl_PerlIO_stdout
866 Perl_PerlIO_tell
867 Perl_PerlIO_unread
868 Perl_PerlIO_write
9df9a5cd 869);
a5564b91
JH
870if ($PLATFORM eq 'netware') {
871 push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
872}
d892637e 873
7766f137 874if ($define{'USE_PERLIO'}) {
d892637e
NIS
875 # Export the symols that make up the PerlIO abstraction, regardless
876 # of its implementation - read from a file
084592ab 877 push @syms, $perlio_sym;
d892637e
NIS
878
879 # This part is then dependent on how the abstraction is implemented
084592ab 880 if ($define{'USE_SFIO'}) {
d892637e 881 # Old legacy non-stdio "PerlIO"
9df9a5cd 882 skip_symbols \@layer_syms;
f1c3982b 883 skip_symbols [qw(perlsio_binmode)];
084592ab 884 # SFIO defines most of the PerlIO routines as macros
d892637e
NIS
885 # So undo most of what $perlio_sym has just done - d'oh !
886 # Perhaps it would be better to list the ones which do exist
887 # And emit them
084592ab
CN
888 skip_symbols [qw(
889 PerlIO_canset_cnt
890 PerlIO_clearerr
891 PerlIO_close
892 PerlIO_eof
893 PerlIO_error
894 PerlIO_exportFILE
895 PerlIO_fast_gets
896 PerlIO_fdopen
897 PerlIO_fileno
898 PerlIO_findFILE
899 PerlIO_flush
900 PerlIO_get_base
901 PerlIO_get_bufsiz
902 PerlIO_get_cnt
903 PerlIO_get_ptr
904 PerlIO_getc
905 PerlIO_getname
906 PerlIO_has_base
907 PerlIO_has_cntptr
908 PerlIO_importFILE
909 PerlIO_open
910 PerlIO_printf
911 PerlIO_putc
912 PerlIO_puts
913 PerlIO_read
914 PerlIO_releaseFILE
915 PerlIO_reopen
916 PerlIO_rewind
917 PerlIO_seek
918 PerlIO_set_cnt
919 PerlIO_set_ptrcnt
920 PerlIO_setlinebuf
921 PerlIO_sprintf
922 PerlIO_stderr
923 PerlIO_stdin
924 PerlIO_stdout
925 PerlIO_stdoutf
926 PerlIO_tell
927 PerlIO_ungetc
928 PerlIO_vprintf
929 PerlIO_write
bcdb689b
JH
930 PerlIO_perlio
931 Perl_PerlIO_clearerr
932 Perl_PerlIO_close
933 Perl_PerlIO_eof
934 Perl_PerlIO_error
935 Perl_PerlIO_fileno
936 Perl_PerlIO_fill
937 Perl_PerlIO_flush
938 Perl_PerlIO_get_base
939 Perl_PerlIO_get_bufsiz
940 Perl_PerlIO_get_cnt
941 Perl_PerlIO_get_ptr
942 Perl_PerlIO_read
943 Perl_PerlIO_seek
944 Perl_PerlIO_set_cnt
945 Perl_PerlIO_set_ptrcnt
946 Perl_PerlIO_setlinebuf
947 Perl_PerlIO_stderr
948 Perl_PerlIO_stdin
949 Perl_PerlIO_stdout
950 Perl_PerlIO_tell
951 Perl_PerlIO_unread
952 Perl_PerlIO_write
ffcf5686
JH
953 PL_def_layerlist
954 PL_known_layers
955 PL_perlio
084592ab
CN
956 )];
957 }
d892637e
NIS
958 else {
959 # PerlIO with layers - export implementation
960 emit_symbols \@layer_syms;
f1c3982b 961 emit_symbols [qw(perlsio_binmode)];
d892637e 962 }
5138f914 963} else {
d892637e
NIS
964 # -Uuseperlio
965 # Skip the PerlIO layer symbols - although
966 # nothing should have exported them any way
9df9a5cd 967 skip_symbols \@layer_syms;
f1c3982b 968 skip_symbols [qw(perlsio_binmode)];
1e8a8f59
NIS
969 skip_symbols [qw(PL_def_layerlist PL_known_layers PL_perlio)];
970
d892637e
NIS
971 # Also do NOT add abstraction symbols from $perlio_sym
972 # abstraction is done as #define to stdio
973 # Remaining remnants that _may_ be functions
974 # are handled in <DATA>
9df9a5cd 975}
7766f137
GS
976
977for my $syms (@syms) {
978 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
979 while (<GLOBAL>) {
980 next if (!/^[A-Za-z]/);
981 # Functions have a Perl_ prefix
982 # Variables have a PL_ prefix
983 chomp($_);
984 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
985 $symbol .= $_;
986 emit_symbol($symbol) unless exists $skip{$symbol};
987 }
988 close(GLOBAL);
989}
0a753a76 990
22c35a8c 991# variables
0a753a76 992
acfe0abc 993if ($define{'MULTIPLICITY'}) {
1acb48c9 994 for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
18c4b137
JH
995 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
996 emit_symbols $glob;
18c4b137 997 }
1acb48c9 998 # XXX AIX seems to want the perlvars.h symbols, for some reason
8257dec7 999 if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') { # OS/2 needs PL_thr_key
1acb48c9 1000 my $glob = readvar($perlvars_h);
51371543
GS
1001 emit_symbols $glob;
1002 }
1003}
1004else {
1005 unless ($define{'PERL_GLOBAL_STRUCT'}) {
549a6b10 1006 my $glob = readvar($perlvars_h);
51371543 1007 emit_symbols $glob;
9df9a5cd 1008 }
51371543 1009 unless ($define{'MULTIPLICITY'}) {
549a6b10 1010 my $glob = readvar($intrpvar_h);
51371543 1011 emit_symbols $glob;
9df9a5cd 1012 }
bbda9c9d 1013 unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
549a6b10 1014 my $glob = readvar($thrdvar_h);
51371543 1015 emit_symbols $glob;
9df9a5cd 1016 }
51371543 1017}
0a753a76 1018
549a6b10
JH
1019sub try_symbol {
1020 my $symbol = shift;
22239a37 1021
4d6b4052 1022 return if $symbol !~ /^[A-Za-z_]/;
549a6b10
JH
1023 return if $symbol =~ /^\#/;
1024 $symbol =~s/\r//g;
1025 chomp($symbol);
43cd9f80 1026 return if exists $skip{$symbol};
549a6b10 1027 emit_symbol($symbol);
3e3baf6d 1028}
0a753a76 1029
549a6b10
JH
1030while (<DATA>) {
1031 try_symbol($_);
ac4c12e7
GS
1032}
1033
18f68570 1034if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1035 foreach my $symbol (qw(
00b02797
JH
1036 setuid
1037 setgid
7766f137 1038 boot_DynaLoader
7766f137 1039 Perl_init_os_extras
c44d3fdb 1040 Perl_thread_create
7766f137 1041 Perl_win32_init
0710cc63 1042 Perl_win32_term
7766f137 1043 RunPerl
5290524f 1044 win32_async_check
7766f137
GS
1045 win32_errno
1046 win32_environ
7766f137
GS
1047 win32_abort
1048 win32_fstat
1049 win32_stat
1050 win32_pipe
1051 win32_popen
1052 win32_pclose
1053 win32_rename
1054 win32_setmode
47185da9 1055 win32_chsize
7766f137
GS
1056 win32_lseek
1057 win32_tell
1058 win32_dup
1059 win32_dup2
1060 win32_open
1061 win32_close
1062 win32_eof
1063 win32_read
1064 win32_write
1065 win32_spawnvp
1066 win32_mkdir
1067 win32_rmdir
1068 win32_chdir
1069 win32_flock
1070 win32_execv
1071 win32_execvp
1072 win32_htons
1073 win32_ntohs
1074 win32_htonl
1075 win32_ntohl
1076 win32_inet_addr
1077 win32_inet_ntoa
1078 win32_socket
1079 win32_bind
1080 win32_listen
1081 win32_accept
1082 win32_connect
1083 win32_send
1084 win32_sendto
1085 win32_recv
1086 win32_recvfrom
1087 win32_shutdown
1088 win32_closesocket
1089 win32_ioctlsocket
1090 win32_setsockopt
1091 win32_getsockopt
1092 win32_getpeername
1093 win32_getsockname
1094 win32_gethostname
1095 win32_gethostbyname
1096 win32_gethostbyaddr
1097 win32_getprotobyname
1098 win32_getprotobynumber
1099 win32_getservbyname
1100 win32_getservbyport
1101 win32_select
1102 win32_endhostent
1103 win32_endnetent
1104 win32_endprotoent
1105 win32_endservent
1106 win32_getnetent
1107 win32_getnetbyname
1108 win32_getnetbyaddr
1109 win32_getprotoent
1110 win32_getservent
1111 win32_sethostent
1112 win32_setnetent
1113 win32_setprotoent
1114 win32_setservent
1115 win32_getenv
1116 win32_putenv
1117 win32_perror
7766f137
GS
1118 win32_malloc
1119 win32_calloc
1120 win32_realloc
1121 win32_free
1122 win32_sleep
1123 win32_times
1124 win32_access
1125 win32_alarm
1126 win32_chmod
1127 win32_open_osfhandle
1128 win32_get_osfhandle
1129 win32_ioctl
1130 win32_link
1131 win32_unlink
1132 win32_utime
57ab3dfe 1133 win32_gettimeofday
7766f137
GS
1134 win32_uname
1135 win32_wait
1136 win32_waitpid
1137 win32_kill
1138 win32_str_os_error
1139 win32_opendir
1140 win32_readdir
1141 win32_telldir
1142 win32_seekdir
1143 win32_rewinddir
1144 win32_closedir
1145 win32_longpath
1146 win32_os_id
1147 win32_getpid
1148 win32_crypt
1149 win32_dynaload
df3728a2
JH
1150 win32_get_childenv
1151 win32_free_childenv
1152 win32_clearenv
1153 win32_get_childdir
1154 win32_free_childdir
00b02797
JH
1155 win32_stdin
1156 win32_stdout
1157 win32_stderr
1158 win32_ferror
1159 win32_feof
1160 win32_strerror
1161 win32_fprintf
1162 win32_printf
1163 win32_vfprintf
1164 win32_vprintf
1165 win32_fread
1166 win32_fwrite
1167 win32_fopen
1168 win32_fdopen
1169 win32_freopen
1170 win32_fclose
1171 win32_fputs
1172 win32_fputc
1173 win32_ungetc
1174 win32_getc
1175 win32_fileno
1176 win32_clearerr
1177 win32_fflush
1178 win32_ftell
1179 win32_fseek
1180 win32_fgetpos
1181 win32_fsetpos
1182 win32_rewind
1183 win32_tmpfile
1184 win32_setbuf
1185 win32_setvbuf
1186 win32_flushall
1187 win32_fcloseall
1188 win32_fgets
1189 win32_gets
1190 win32_fgetc
1191 win32_putc
1192 win32_puts
1193 win32_getchar
1194 win32_putchar
7766f137
GS
1195 ))
1196 {
549a6b10
JH
1197 try_symbol($symbol);
1198 }
1199}
3cfae81b 1200elsif ($PLATFORM eq 'os2') {
7766f137
GS
1201 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1202 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1203 close MAP or die 'Cannot close miniperl.map';
1204
ad6971c8 1205 @missing = grep { !exists $mapped{$_} }
7766f137 1206 keys %export;
c6261f3b 1207 @missing = grep { !exists $exportperlmalloc{$_} } @missing;
7766f137 1208 delete $export{$_} foreach @missing;
3cfae81b 1209}
084592ab
CN
1210elsif ($PLATFORM eq 'MacOS') {
1211 open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
1212
1213 while (<MACSYMS>) {
1214 try_symbol($_);
1215 }
1216
1217 close MACSYMS;
1218}
2986a63f
JH
1219elsif ($PLATFORM eq 'netware') {
1220foreach my $symbol (qw(
1221 boot_DynaLoader
1222 Perl_init_os_extras
1223 Perl_thread_create
1224 Perl_nw5_init
1225 RunPerl
1226 AllocStdPerl
1227 FreeStdPerl
1228 do_spawn2
1229 do_aspawn
1230 nw_uname
1231 nw_stdin
1232 nw_stdout
1233 nw_stderr
1234 nw_feof
1235 nw_ferror
1236 nw_fopen
1237 nw_fclose
1238 nw_clearerr
1239 nw_getc
1240 nw_fgets
1241 nw_fputc
1242 nw_fputs
1243 nw_fflush
1244 nw_ungetc
1245 nw_fileno
1246 nw_fdopen
1247 nw_freopen
1248 nw_fread
1249 nw_fwrite
1250 nw_setbuf
1251 nw_setvbuf
1252 nw_vfprintf
1253 nw_ftell
1254 nw_fseek
1255 nw_rewind
1256 nw_tmpfile
1257 nw_fgetpos
1258 nw_fsetpos
1259 nw_dup
1260 nw_access
1261 nw_chmod
1262 nw_chsize
1263 nw_close
1264 nw_dup2
1265 nw_flock
1266 nw_isatty
1267 nw_link
1268 nw_lseek
1269 nw_stat
1270 nw_mktemp
1271 nw_open
1272 nw_read
1273 nw_rename
1274 nw_setmode
1275 nw_unlink
1276 nw_utime
1277 nw_write
1278 nw_chdir
1279 nw_rmdir
1280 nw_closedir
1281 nw_opendir
1282 nw_readdir
1283 nw_rewinddir
1284 nw_seekdir
1285 nw_telldir
1286 nw_htonl
1287 nw_htons
1288 nw_ntohl
1289 nw_ntohs
1290 nw_accept
1291 nw_bind
1292 nw_connect
1293 nw_endhostent
1294 nw_endnetent
1295 nw_endprotoent
1296 nw_endservent
1297 nw_gethostbyaddr
1298 nw_gethostbyname
1299 nw_gethostent
1300 nw_gethostname
1301 nw_getnetbyaddr
1302 nw_getnetbyname
1303 nw_getnetent
1304 nw_getpeername
1305 nw_getprotobyname
1306 nw_getprotobynumber
1307 nw_getprotoent
1308 nw_getservbyname
1309 nw_getservbyport
1310 nw_getservent
1311 nw_getsockname
1312 nw_getsockopt
1313 nw_inet_addr
1314 nw_listen
1315 nw_socket
1316 nw_recv
1317 nw_recvfrom
1318 nw_select
1319 nw_send
1320 nw_sendto
1321 nw_sethostent
1322 nw_setnetent
1323 nw_setprotoent
1324 nw_setservent
3a0827a6 1325 nw_setsockopt
4d76e4b4 1326 nw_inet_ntoa
2986a63f
JH
1327 nw_shutdown
1328 nw_crypt
1329 nw_execvp
1330 nw_kill
1331 nw_Popen
1332 nw_Pclose
1333 nw_Pipe
1334 nw_times
1335 nw_waitpid
1336 nw_getpid
1337 nw_spawnvp
1338 nw_os_id
1339 nw_open_osfhandle
1340 nw_get_osfhandle
1341 nw_abort
1342 nw_sleep
1343 nw_wait
1344 nw_dynaload
1345 nw_strerror
1346 fnFpSetMode
1347 fnInsertHashListAddrs
1348 fnGetHashListAddrs
1349 Perl_deb
011f1a1a
JH
1350 Perl_sv_setsv
1351 Perl_sv_catsv
1352 Perl_sv_catpvn
1353 Perl_sv_2pv
f355267c
JH
1354 nw_freeenviron
1355 Remove_Thread_Ctx
2986a63f
JH
1356 ))
1357 {
1358 try_symbol($symbol);
1359 }
1360}
22239a37 1361
5991d125
NC
1362# records of type boot_module for statically linked modules (except Dynaloader)
1363$static_ext =~ s/\//__/g;
1364$static_ext =~ s/\bDynaLoader\b//;
1365my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1366foreach my $symbol (@stat_mods)
1367 {
1368 try_symbol($symbol);
1369 }
1370
549a6b10
JH
1371# Now all symbols should be defined because
1372# next we are going to output them.
1373
7766f137
GS
1374foreach my $symbol (sort keys %export) {
1375 output_symbol($symbol);
1376}
549a6b10 1377
011f1a1a 1378if ($PLATFORM eq 'os2') {
17999b1c
IZ
1379 print <<EOP;
1380 dll_perlmain=main
133fa74f
IZ
1381 fill_extLibpath
1382 dir_subst
1383 Perl_OS2_handler_install
1384
17999b1c
IZ
1385; LAST_ORDINAL=$sym_ord
1386EOP
2986a63f
JH
1387}
1388
549a6b10 1389sub emit_symbol {
7766f137 1390 my $symbol = shift;
9df9a5cd 1391 chomp($symbol);
7766f137 1392 $export{$symbol} = 1;
549a6b10
JH
1393}
1394
1395sub output_symbol {
1396 my $symbol = shift;
18f68570 1397 if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1398 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 1399 print "\t$symbol\n";
549a6b10
JH
1400# XXX: binary compatibility between compilers is an exercise
1401# in frustration :-(
1402# if ($CCTYPE eq "BORLAND") {
1403# # workaround Borland quirk by exporting both the straight
1404# # name and a name with leading underscore. Note the
1405# # alias *must* come after the symbol itself, if both
1406# # are to be exported. (Linker bug?)
1407# print "\t_$symbol\n";
1408# print "\t$symbol = _$symbol\n";
1409# }
1410# elsif ($CCTYPE eq 'GCC') {
1411# # Symbols have leading _ whole process is $%@"% slow
1412# # so skip aliases for now
1413# nprint "\t$symbol\n";
1414# }
1415# else {
1416# # for binary coexistence, export both the symbol and
1417# # alias with leading underscore
1418# print "\t$symbol\n";
1419# print "\t_$symbol = $symbol\n";
1420# }
7766f137
GS
1421 }
1422 elsif ($PLATFORM eq 'os2') {
52e4c282
IZ
1423 printf qq( %-31s \@%s\n),
1424 qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
78232bc0
JH
1425 printf qq( %-31s \@%s\n),
1426 qq("$exportperlmalloc{$symbol}" = "$symbol"),
1427 $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1428 if $exportperlmalloc and exists $exportperlmalloc{$symbol};
7766f137 1429 }
084592ab 1430 elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
549a6b10
JH
1431 print "$symbol\n";
1432 }
2986a63f
JH
1433 elsif ($PLATFORM eq 'netware') {
1434 print "\t$symbol,\n";
1435 }
549a6b10
JH
1436}
1437
14381;
1439__DATA__
1440# extra globals not included above.
8437356b 1441Perl_cxinc
549a6b10 1442perl_alloc
7766f137 1443perl_alloc_using
014822e4
GS
1444perl_clone
1445perl_clone_using
549a6b10
JH
1446perl_construct
1447perl_destruct
1448perl_free
1449perl_parse
1450perl_run
44798d05 1451# Oddities from PerlIO
568ad336 1452PerlIO_binmode
8437356b 1453PerlIO_getpos
568ad336 1454PerlIO_init
568ad336 1455PerlIO_setpos
568ad336 1456PerlIO_sprintf
8437356b
MB
1457PerlIO_sv_dup
1458PerlIO_tmpfile
8437356b 1459PerlIO_vsprintf