This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate:
[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
701 Perl_sys_intern_dup
86593e8d 702 Perl_ptr_table_clear
7766f137 703 Perl_ptr_table_fetch
86593e8d 704 Perl_ptr_table_free
7766f137 705 Perl_ptr_table_new
4ac9195f
MS
706 Perl_ptr_table_clear
707 Perl_ptr_table_free
7766f137
GS
708 Perl_ptr_table_split
709 Perl_ptr_table_store
710 perl_clone
711 perl_clone_using
038f0558
JH
712 Perl_sharedsv_find
713 Perl_sharedsv_init
714 Perl_sharedsv_lock
715 Perl_sharedsv_new
716 Perl_sharedsv_thrcnt_dec
717 Perl_sharedsv_thrcnt_inc
718 Perl_sharedsv_unlock
7766f137
GS
719 )];
720}
721
722unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
723 skip_symbols [qw(
724 Perl_croak_nocontext
725 Perl_die_nocontext
726 Perl_deb_nocontext
727 Perl_form_nocontext
e0f4245d 728 Perl_load_module_nocontext
7766f137
GS
729 Perl_mess_nocontext
730 Perl_warn_nocontext
731 Perl_warner_nocontext
732 Perl_newSVpvf_nocontext
733 Perl_sv_catpvf_nocontext
734 Perl_sv_setpvf_nocontext
735 Perl_sv_catpvf_mg_nocontext
736 Perl_sv_setpvf_mg_nocontext
737 )];
738}
739
740unless ($define{'PERL_IMPLICIT_SYS'}) {
741 skip_symbols [qw(
742 perl_alloc_using
014822e4 743 perl_clone_using
7766f137
GS
744 )];
745}
746
747unless ($define{'FAKE_THREADS'}) {
748 skip_symbols [qw(PL_curthr)];
749}
750
ac6bedea
JH
751unless ($define{'PL_OP_SLAB_ALLOC'}) {
752 skip_symbols [qw(
753 PL_OpPtr
754 PL_OpSlab
755 PL_OpSpace
f4a6c1f7
JH
756 Perl_Slab_Alloc
757 Perl_Slab_Free
ac6bedea
JH
758 )];
759}
760
5b7ea690
JH
761unless ($define{'THREADS_HAVE_PIDS'}) {
762 skip_symbols [qw(PL_ppid)];
763}
764
7766f137
GS
765sub readvar {
766 my $file = shift;
767 my $proc = shift || sub { "PL_$_[2]" };
768 open(VARS,$file) || die "Cannot open $file: $!\n";
769 my @syms;
770 while (<VARS>) {
771 # All symbols have a Perl_ prefix because that's what embed.h
772 # sticks in front of them.
773 push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?C?)\(([IGT])(\w+)/);
9df9a5cd
NIS
774 }
775 close(VARS);
7766f137
GS
776 return \@syms;
777}
778
6f4183fe 779if ($define{'USE_5005THREADS'}) {
7766f137
GS
780 my $thrd = readvar($thrdvar_h);
781 skip_symbols $thrd;
782}
783
7766f137
GS
784if ($define{'PERL_GLOBAL_STRUCT'}) {
785 my $global = readvar($perlvars_h);
786 skip_symbols $global;
787 emit_symbol('Perl_GetVars');
788 emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
789}
36c15d3f 790
22c35a8c
GS
791# functions from *.sym files
792
954c1994 793my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
549a6b10 794
d892637e
NIS
795# Symbols that are the public face of the PerlIO layers implementation
796# These are in _addition to_ the public face of the abstraction
797# and need to be exported to allow XS modules to implement layers
9df9a5cd 798my @layer_syms = qw(
64aa19bc
JH
799 PerlIOBase_binmode
800 PerlIOBase_clearerr
801 PerlIOBase_close
802 PerlIOBase_dup
803 PerlIOBase_eof
804 PerlIOBase_error
805 PerlIOBase_fileno
806 PerlIOBase_noop_fail
807 PerlIOBase_noop_ok
808 PerlIOBase_popped
cc5c63cd 809 PerlIOBase_pushed
64aa19bc
JH
810 PerlIOBase_read
811 PerlIOBase_setlinebuf
812 PerlIOBase_unread
813 PerlIOBuf_bufsiz
814 PerlIOBuf_close
815 PerlIOBuf_dup
816 PerlIOBuf_fill
817 PerlIOBuf_flush
818 PerlIOBuf_get_base
819 PerlIOBuf_get_cnt
820 PerlIOBuf_get_ptr
821 PerlIOBuf_open
822 PerlIOBuf_popped
823 PerlIOBuf_pushed
824 PerlIOBuf_read
825 PerlIOBuf_seek
826 PerlIOBuf_set_ptrcnt
827 PerlIOBuf_tell
828 PerlIOBuf_unread
829 PerlIOBuf_write
830 PerlIO_allocate
cc5c63cd 831 PerlIO_apply_layera
64aa19bc
JH
832 PerlIO_apply_layers
833 PerlIO_arg_fetch
834 PerlIO_debug
835 PerlIO_define_layer
ac388100 836 PerlIO_isutf8
64aa19bc
JH
837 PerlIO_layer_fetch
838 PerlIO_list_free
839 PerlIO_modestr
840 PerlIO_parse_layers
841 PerlIO_pending
842 PerlIO_perlio
843 PerlIO_pop
844 PerlIO_push
845 PerlIO_sv_dup
846 Perl_PerlIO_clearerr
847 Perl_PerlIO_close
848 Perl_PerlIO_eof
849 Perl_PerlIO_error
850 Perl_PerlIO_fileno
851 Perl_PerlIO_fill
852 Perl_PerlIO_flush
853 Perl_PerlIO_get_base
854 Perl_PerlIO_get_bufsiz
855 Perl_PerlIO_get_cnt
856 Perl_PerlIO_get_ptr
857 Perl_PerlIO_read
858 Perl_PerlIO_seek
859 Perl_PerlIO_set_cnt
860 Perl_PerlIO_set_ptrcnt
861 Perl_PerlIO_setlinebuf
862 Perl_PerlIO_stderr
863 Perl_PerlIO_stdin
864 Perl_PerlIO_stdout
865 Perl_PerlIO_tell
866 Perl_PerlIO_unread
867 Perl_PerlIO_write
9df9a5cd 868);
a5564b91
JH
869if ($PLATFORM eq 'netware') {
870 push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
871}
d892637e 872
7766f137 873if ($define{'USE_PERLIO'}) {
d892637e
NIS
874 # Export the symols that make up the PerlIO abstraction, regardless
875 # of its implementation - read from a file
084592ab 876 push @syms, $perlio_sym;
d892637e
NIS
877
878 # This part is then dependent on how the abstraction is implemented
084592ab 879 if ($define{'USE_SFIO'}) {
d892637e 880 # Old legacy non-stdio "PerlIO"
9df9a5cd 881 skip_symbols \@layer_syms;
084592ab 882 # SFIO defines most of the PerlIO routines as macros
d892637e
NIS
883 # So undo most of what $perlio_sym has just done - d'oh !
884 # Perhaps it would be better to list the ones which do exist
885 # And emit them
084592ab
CN
886 skip_symbols [qw(
887 PerlIO_canset_cnt
888 PerlIO_clearerr
889 PerlIO_close
890 PerlIO_eof
891 PerlIO_error
892 PerlIO_exportFILE
893 PerlIO_fast_gets
894 PerlIO_fdopen
895 PerlIO_fileno
896 PerlIO_findFILE
897 PerlIO_flush
898 PerlIO_get_base
899 PerlIO_get_bufsiz
900 PerlIO_get_cnt
901 PerlIO_get_ptr
902 PerlIO_getc
903 PerlIO_getname
904 PerlIO_has_base
905 PerlIO_has_cntptr
906 PerlIO_importFILE
907 PerlIO_open
908 PerlIO_printf
909 PerlIO_putc
910 PerlIO_puts
911 PerlIO_read
912 PerlIO_releaseFILE
913 PerlIO_reopen
914 PerlIO_rewind
915 PerlIO_seek
916 PerlIO_set_cnt
917 PerlIO_set_ptrcnt
918 PerlIO_setlinebuf
919 PerlIO_sprintf
920 PerlIO_stderr
921 PerlIO_stdin
922 PerlIO_stdout
923 PerlIO_stdoutf
924 PerlIO_tell
925 PerlIO_ungetc
926 PerlIO_vprintf
927 PerlIO_write
bcdb689b
JH
928 PerlIO_perlio
929 Perl_PerlIO_clearerr
930 Perl_PerlIO_close
931 Perl_PerlIO_eof
932 Perl_PerlIO_error
933 Perl_PerlIO_fileno
934 Perl_PerlIO_fill
935 Perl_PerlIO_flush
936 Perl_PerlIO_get_base
937 Perl_PerlIO_get_bufsiz
938 Perl_PerlIO_get_cnt
939 Perl_PerlIO_get_ptr
940 Perl_PerlIO_read
941 Perl_PerlIO_seek
942 Perl_PerlIO_set_cnt
943 Perl_PerlIO_set_ptrcnt
944 Perl_PerlIO_setlinebuf
945 Perl_PerlIO_stderr
946 Perl_PerlIO_stdin
947 Perl_PerlIO_stdout
948 Perl_PerlIO_tell
949 Perl_PerlIO_unread
950 Perl_PerlIO_write
ffcf5686
JH
951 PL_def_layerlist
952 PL_known_layers
953 PL_perlio
084592ab
CN
954 )];
955 }
d892637e
NIS
956 else {
957 # PerlIO with layers - export implementation
958 emit_symbols \@layer_syms;
959 }
5138f914 960} else {
d892637e
NIS
961 # -Uuseperlio
962 # Skip the PerlIO layer symbols - although
963 # nothing should have exported them any way
9df9a5cd 964 skip_symbols \@layer_syms;
1e8a8f59
NIS
965 skip_symbols [qw(PL_def_layerlist PL_known_layers PL_perlio)];
966
d892637e
NIS
967 # Also do NOT add abstraction symbols from $perlio_sym
968 # abstraction is done as #define to stdio
969 # Remaining remnants that _may_ be functions
970 # are handled in <DATA>
9df9a5cd 971}
7766f137
GS
972
973for my $syms (@syms) {
974 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
975 while (<GLOBAL>) {
976 next if (!/^[A-Za-z]/);
977 # Functions have a Perl_ prefix
978 # Variables have a PL_ prefix
979 chomp($_);
980 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
981 $symbol .= $_;
982 emit_symbol($symbol) unless exists $skip{$symbol};
983 }
984 close(GLOBAL);
985}
0a753a76 986
22c35a8c 987# variables
0a753a76 988
acfe0abc 989if ($define{'MULTIPLICITY'}) {
1acb48c9 990 for my $f ($perlvars_h, $intrpvar_h, $thrdvar_h) {
18c4b137
JH
991 my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
992 emit_symbols $glob;
18c4b137 993 }
1acb48c9 994 # XXX AIX seems to want the perlvars.h symbols, for some reason
8257dec7 995 if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') { # OS/2 needs PL_thr_key
1acb48c9 996 my $glob = readvar($perlvars_h);
51371543
GS
997 emit_symbols $glob;
998 }
999}
1000else {
1001 unless ($define{'PERL_GLOBAL_STRUCT'}) {
549a6b10 1002 my $glob = readvar($perlvars_h);
51371543 1003 emit_symbols $glob;
9df9a5cd 1004 }
51371543 1005 unless ($define{'MULTIPLICITY'}) {
549a6b10 1006 my $glob = readvar($intrpvar_h);
51371543 1007 emit_symbols $glob;
9df9a5cd 1008 }
bbda9c9d 1009 unless ($define{'MULTIPLICITY'} || $define{'USE_5005THREADS'}) {
549a6b10 1010 my $glob = readvar($thrdvar_h);
51371543 1011 emit_symbols $glob;
9df9a5cd 1012 }
51371543 1013}
0a753a76 1014
549a6b10
JH
1015sub try_symbol {
1016 my $symbol = shift;
22239a37 1017
4d6b4052 1018 return if $symbol !~ /^[A-Za-z_]/;
549a6b10
JH
1019 return if $symbol =~ /^\#/;
1020 $symbol =~s/\r//g;
1021 chomp($symbol);
43cd9f80 1022 return if exists $skip{$symbol};
549a6b10 1023 emit_symbol($symbol);
3e3baf6d 1024}
0a753a76 1025
549a6b10
JH
1026while (<DATA>) {
1027 try_symbol($_);
ac4c12e7
GS
1028}
1029
18f68570 1030if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1031 foreach my $symbol (qw(
00b02797
JH
1032 setuid
1033 setgid
7766f137 1034 boot_DynaLoader
7766f137 1035 Perl_init_os_extras
c44d3fdb 1036 Perl_thread_create
7766f137 1037 Perl_win32_init
0710cc63 1038 Perl_win32_term
7766f137 1039 RunPerl
5290524f 1040 win32_async_check
7766f137
GS
1041 win32_errno
1042 win32_environ
7766f137
GS
1043 win32_abort
1044 win32_fstat
1045 win32_stat
1046 win32_pipe
1047 win32_popen
1048 win32_pclose
1049 win32_rename
1050 win32_setmode
47185da9 1051 win32_chsize
7766f137
GS
1052 win32_lseek
1053 win32_tell
1054 win32_dup
1055 win32_dup2
1056 win32_open
1057 win32_close
1058 win32_eof
1059 win32_read
1060 win32_write
1061 win32_spawnvp
1062 win32_mkdir
1063 win32_rmdir
1064 win32_chdir
1065 win32_flock
1066 win32_execv
1067 win32_execvp
1068 win32_htons
1069 win32_ntohs
1070 win32_htonl
1071 win32_ntohl
1072 win32_inet_addr
1073 win32_inet_ntoa
1074 win32_socket
1075 win32_bind
1076 win32_listen
1077 win32_accept
1078 win32_connect
1079 win32_send
1080 win32_sendto
1081 win32_recv
1082 win32_recvfrom
1083 win32_shutdown
1084 win32_closesocket
1085 win32_ioctlsocket
1086 win32_setsockopt
1087 win32_getsockopt
1088 win32_getpeername
1089 win32_getsockname
1090 win32_gethostname
1091 win32_gethostbyname
1092 win32_gethostbyaddr
1093 win32_getprotobyname
1094 win32_getprotobynumber
1095 win32_getservbyname
1096 win32_getservbyport
1097 win32_select
1098 win32_endhostent
1099 win32_endnetent
1100 win32_endprotoent
1101 win32_endservent
1102 win32_getnetent
1103 win32_getnetbyname
1104 win32_getnetbyaddr
1105 win32_getprotoent
1106 win32_getservent
1107 win32_sethostent
1108 win32_setnetent
1109 win32_setprotoent
1110 win32_setservent
1111 win32_getenv
1112 win32_putenv
1113 win32_perror
7766f137
GS
1114 win32_malloc
1115 win32_calloc
1116 win32_realloc
1117 win32_free
1118 win32_sleep
1119 win32_times
1120 win32_access
1121 win32_alarm
1122 win32_chmod
1123 win32_open_osfhandle
1124 win32_get_osfhandle
1125 win32_ioctl
1126 win32_link
1127 win32_unlink
1128 win32_utime
57ab3dfe 1129 win32_gettimeofday
7766f137
GS
1130 win32_uname
1131 win32_wait
1132 win32_waitpid
1133 win32_kill
1134 win32_str_os_error
1135 win32_opendir
1136 win32_readdir
1137 win32_telldir
1138 win32_seekdir
1139 win32_rewinddir
1140 win32_closedir
1141 win32_longpath
1142 win32_os_id
1143 win32_getpid
1144 win32_crypt
1145 win32_dynaload
df3728a2
JH
1146 win32_get_childenv
1147 win32_free_childenv
1148 win32_clearenv
1149 win32_get_childdir
1150 win32_free_childdir
00b02797
JH
1151 win32_stdin
1152 win32_stdout
1153 win32_stderr
1154 win32_ferror
1155 win32_feof
1156 win32_strerror
1157 win32_fprintf
1158 win32_printf
1159 win32_vfprintf
1160 win32_vprintf
1161 win32_fread
1162 win32_fwrite
1163 win32_fopen
1164 win32_fdopen
1165 win32_freopen
1166 win32_fclose
1167 win32_fputs
1168 win32_fputc
1169 win32_ungetc
1170 win32_getc
1171 win32_fileno
1172 win32_clearerr
1173 win32_fflush
1174 win32_ftell
1175 win32_fseek
1176 win32_fgetpos
1177 win32_fsetpos
1178 win32_rewind
1179 win32_tmpfile
1180 win32_setbuf
1181 win32_setvbuf
1182 win32_flushall
1183 win32_fcloseall
1184 win32_fgets
1185 win32_gets
1186 win32_fgetc
1187 win32_putc
1188 win32_puts
1189 win32_getchar
1190 win32_putchar
7766f137
GS
1191 ))
1192 {
549a6b10
JH
1193 try_symbol($symbol);
1194 }
1195}
3cfae81b 1196elsif ($PLATFORM eq 'os2') {
7766f137
GS
1197 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1198 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1199 close MAP or die 'Cannot close miniperl.map';
1200
ad6971c8 1201 @missing = grep { !exists $mapped{$_} }
7766f137 1202 keys %export;
c6261f3b 1203 @missing = grep { !exists $exportperlmalloc{$_} } @missing;
7766f137 1204 delete $export{$_} foreach @missing;
3cfae81b 1205}
084592ab
CN
1206elsif ($PLATFORM eq 'MacOS') {
1207 open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
1208
1209 while (<MACSYMS>) {
1210 try_symbol($_);
1211 }
1212
1213 close MACSYMS;
1214}
2986a63f
JH
1215elsif ($PLATFORM eq 'netware') {
1216foreach my $symbol (qw(
1217 boot_DynaLoader
1218 Perl_init_os_extras
1219 Perl_thread_create
1220 Perl_nw5_init
1221 RunPerl
1222 AllocStdPerl
1223 FreeStdPerl
1224 do_spawn2
1225 do_aspawn
1226 nw_uname
1227 nw_stdin
1228 nw_stdout
1229 nw_stderr
1230 nw_feof
1231 nw_ferror
1232 nw_fopen
1233 nw_fclose
1234 nw_clearerr
1235 nw_getc
1236 nw_fgets
1237 nw_fputc
1238 nw_fputs
1239 nw_fflush
1240 nw_ungetc
1241 nw_fileno
1242 nw_fdopen
1243 nw_freopen
1244 nw_fread
1245 nw_fwrite
1246 nw_setbuf
1247 nw_setvbuf
1248 nw_vfprintf
1249 nw_ftell
1250 nw_fseek
1251 nw_rewind
1252 nw_tmpfile
1253 nw_fgetpos
1254 nw_fsetpos
1255 nw_dup
1256 nw_access
1257 nw_chmod
1258 nw_chsize
1259 nw_close
1260 nw_dup2
1261 nw_flock
1262 nw_isatty
1263 nw_link
1264 nw_lseek
1265 nw_stat
1266 nw_mktemp
1267 nw_open
1268 nw_read
1269 nw_rename
1270 nw_setmode
1271 nw_unlink
1272 nw_utime
1273 nw_write
1274 nw_chdir
1275 nw_rmdir
1276 nw_closedir
1277 nw_opendir
1278 nw_readdir
1279 nw_rewinddir
1280 nw_seekdir
1281 nw_telldir
1282 nw_htonl
1283 nw_htons
1284 nw_ntohl
1285 nw_ntohs
1286 nw_accept
1287 nw_bind
1288 nw_connect
1289 nw_endhostent
1290 nw_endnetent
1291 nw_endprotoent
1292 nw_endservent
1293 nw_gethostbyaddr
1294 nw_gethostbyname
1295 nw_gethostent
1296 nw_gethostname
1297 nw_getnetbyaddr
1298 nw_getnetbyname
1299 nw_getnetent
1300 nw_getpeername
1301 nw_getprotobyname
1302 nw_getprotobynumber
1303 nw_getprotoent
1304 nw_getservbyname
1305 nw_getservbyport
1306 nw_getservent
1307 nw_getsockname
1308 nw_getsockopt
1309 nw_inet_addr
1310 nw_listen
1311 nw_socket
1312 nw_recv
1313 nw_recvfrom
1314 nw_select
1315 nw_send
1316 nw_sendto
1317 nw_sethostent
1318 nw_setnetent
1319 nw_setprotoent
1320 nw_setservent
3a0827a6 1321 nw_setsockopt
4d76e4b4 1322 nw_inet_ntoa
2986a63f
JH
1323 nw_shutdown
1324 nw_crypt
1325 nw_execvp
1326 nw_kill
1327 nw_Popen
1328 nw_Pclose
1329 nw_Pipe
1330 nw_times
1331 nw_waitpid
1332 nw_getpid
1333 nw_spawnvp
1334 nw_os_id
1335 nw_open_osfhandle
1336 nw_get_osfhandle
1337 nw_abort
1338 nw_sleep
1339 nw_wait
1340 nw_dynaload
1341 nw_strerror
1342 fnFpSetMode
1343 fnInsertHashListAddrs
1344 fnGetHashListAddrs
1345 Perl_deb
011f1a1a
JH
1346 Perl_sv_setsv
1347 Perl_sv_catsv
1348 Perl_sv_catpvn
1349 Perl_sv_2pv
f355267c
JH
1350 nw_freeenviron
1351 Remove_Thread_Ctx
2986a63f
JH
1352 ))
1353 {
1354 try_symbol($symbol);
1355 }
1356}
22239a37 1357
5991d125
NC
1358# records of type boot_module for statically linked modules (except Dynaloader)
1359$static_ext =~ s/\//__/g;
1360$static_ext =~ s/\bDynaLoader\b//;
1361my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1362foreach my $symbol (@stat_mods)
1363 {
1364 try_symbol($symbol);
1365 }
1366
549a6b10
JH
1367# Now all symbols should be defined because
1368# next we are going to output them.
1369
7766f137
GS
1370foreach my $symbol (sort keys %export) {
1371 output_symbol($symbol);
1372}
549a6b10 1373
011f1a1a 1374if ($PLATFORM eq 'os2') {
17999b1c
IZ
1375 print <<EOP;
1376 dll_perlmain=main
133fa74f
IZ
1377 fill_extLibpath
1378 dir_subst
1379 Perl_OS2_handler_install
1380
17999b1c
IZ
1381; LAST_ORDINAL=$sym_ord
1382EOP
2986a63f
JH
1383}
1384
549a6b10 1385sub emit_symbol {
7766f137 1386 my $symbol = shift;
9df9a5cd 1387 chomp($symbol);
7766f137 1388 $export{$symbol} = 1;
549a6b10
JH
1389}
1390
1391sub output_symbol {
1392 my $symbol = shift;
18f68570 1393 if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1394 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 1395 print "\t$symbol\n";
549a6b10
JH
1396# XXX: binary compatibility between compilers is an exercise
1397# in frustration :-(
1398# if ($CCTYPE eq "BORLAND") {
1399# # workaround Borland quirk by exporting both the straight
1400# # name and a name with leading underscore. Note the
1401# # alias *must* come after the symbol itself, if both
1402# # are to be exported. (Linker bug?)
1403# print "\t_$symbol\n";
1404# print "\t$symbol = _$symbol\n";
1405# }
1406# elsif ($CCTYPE eq 'GCC') {
1407# # Symbols have leading _ whole process is $%@"% slow
1408# # so skip aliases for now
1409# nprint "\t$symbol\n";
1410# }
1411# else {
1412# # for binary coexistence, export both the symbol and
1413# # alias with leading underscore
1414# print "\t$symbol\n";
1415# print "\t_$symbol = $symbol\n";
1416# }
7766f137
GS
1417 }
1418 elsif ($PLATFORM eq 'os2') {
52e4c282
IZ
1419 printf qq( %-31s \@%s\n),
1420 qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
78232bc0
JH
1421 printf qq( %-31s \@%s\n),
1422 qq("$exportperlmalloc{$symbol}" = "$symbol"),
1423 $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1424 if $exportperlmalloc and exists $exportperlmalloc{$symbol};
7766f137 1425 }
084592ab 1426 elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
549a6b10
JH
1427 print "$symbol\n";
1428 }
2986a63f
JH
1429 elsif ($PLATFORM eq 'netware') {
1430 print "\t$symbol,\n";
1431 }
549a6b10
JH
1432}
1433
14341;
1435__DATA__
1436# extra globals not included above.
8437356b 1437Perl_cxinc
549a6b10 1438perl_alloc
7766f137 1439perl_alloc_using
014822e4
GS
1440perl_clone
1441perl_clone_using
549a6b10
JH
1442perl_construct
1443perl_destruct
1444perl_free
1445perl_parse
1446perl_run
44798d05 1447# Oddities from PerlIO
568ad336 1448PerlIO_binmode
8437356b 1449PerlIO_getpos
568ad336 1450PerlIO_init
568ad336 1451PerlIO_setpos
568ad336 1452PerlIO_sprintf
8437356b
MB
1453PerlIO_sv_dup
1454PerlIO_tmpfile
8437356b
MB
1455PerlIO_vsprintf
1456perlsio_binmode