xref: /openbsd/gnu/usr.bin/perl/makedef.pl (revision 17df1aa7)
1#./perl -w
2#
3# Create the export list for perl.
4#
5# Needed by WIN32 and OS/2 for creating perl.dll,
6# and by AIX for creating libperl.a when -Dusershrplib is in effect,
7# and by MacOS Classic.
8#
9# Reads from information stored in
10#
11#    config.h
12#    config.sh
13#    global.sym
14#    globvar.sym
15#    intrpvar.h
16#    macperl.sym  (on MacOS)
17#    miniperl.map (on OS/2)
18#    perl5.def    (on OS/2; this is the old version of the file being made)
19#    perlio.sym
20#    perlvars.h
21#
22# plus long lists of function names hard-coded directly in this script and
23# in the DATA section.
24#
25# Writes the result to STDOUT.
26#
27# Normally this script is invoked from a makefile (e.g. win32/Makefile),
28# which redirects STDOUT to a suitable file, such as:
29#
30#    perl5.def   OS/2
31#    perldll.def Windows
32#    perl.exp    AIX
33#    perl.imp    NetWare
34
35
36BEGIN { unshift @INC, "lib" }
37use strict;
38
39use vars qw($PLATFORM $CCTYPE $FILETYPE $CONFIG_ARGS $ARCHNAME $PATCHLEVEL);
40
41my (%define, %ordinal);
42
43while (@ARGV) {
44    my $flag = shift;
45    if ($flag =~ s/^CC_FLAGS=/ /) {
46	for my $fflag ($flag =~ /(?:^|\s)-D(\S+)/g) {
47	    $fflag     .= '=1' unless $fflag =~ /^(\w+)=/;
48	    $define{$1} = $2   if $fflag =~ /^(\w+)=(.+)$/;
49	}
50	next;
51    }
52    $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
53    $define{$1} = $2 if ($flag =~ /^-D(\w+)=(.+)$/);
54    $CCTYPE   = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
55    $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
56    if ($PLATFORM eq 'netware') {
57	$FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
58    }
59}
60
61my @PLATFORM = qw(aix win32 wince os2 MacOS netware);
62my %PLATFORM;
63@PLATFORM{@PLATFORM} = ();
64
65defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
66exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
67
68if ($PLATFORM eq 'win32' or $PLATFORM eq 'wince' or $PLATFORM eq "aix") {
69	# Add the compile-time options that miniperl was built with to %define.
70	# On Win32 these are not the same options as perl itself will be built
71	# with since miniperl is built with a canned config (one of the win32/
72	# config_H.*) and none of the BUILDOPT's that are set in the makefiles,
73	# but they do include some #define's that are hard-coded in various
74	# source files and header files and don't include any BUILDOPT's that
75	# the user might have chosen to disable because the canned configs are
76	# minimal configs that don't include any of those options.
77	my $opts = ($PLATFORM eq 'wince' ? '-MCross' : ''); # for wince need Cross.pm to get Config.pm
78	my $config = `$^X $opts -Ilib -V`;
79	my($options) = $config =~ /^  Compile-time options: (.*?)\n^  \S/ms;
80	$options =~ s/\s+/ /g;
81	print STDERR "Options: ($options)\n";
82	foreach (split /\s+/, $options) {
83		$define{$_} = 1;
84	}
85}
86
87my %exportperlmalloc =
88    (
89       Perl_malloc		=>	"malloc",
90       Perl_mfree		=>	"free",
91       Perl_realloc		=>	"realloc",
92       Perl_calloc		=>	"calloc",
93    );
94
95my $exportperlmalloc = $PLATFORM eq 'os2';
96
97my $config_sh   = "config.sh";
98my $config_h    = "config.h";
99my $intrpvar_h  = "intrpvar.h";
100my $perlvars_h  = "perlvars.h";
101my $global_sym  = "global.sym";
102my $pp_sym      = "pp.sym";
103my $globvar_sym = "globvar.sym";
104my $perlio_sym  = "perlio.sym";
105my $static_ext = "";
106
107if ($PLATFORM eq 'aix') {
108    # Nothing for now.
109}
110elsif ($PLATFORM =~ /^win(?:32|ce)$/ || $PLATFORM eq 'netware') {
111    $CCTYPE = "MSVC" unless defined $CCTYPE;
112    foreach ($intrpvar_h, $perlvars_h, $global_sym,
113	     $pp_sym, $globvar_sym, $perlio_sym) {
114	s!^!..\\!;
115    }
116}
117elsif ($PLATFORM eq 'MacOS') {
118    foreach ($intrpvar_h, $perlvars_h, $global_sym,
119	     $pp_sym, $globvar_sym, $perlio_sym) {
120	s!^!::!;
121    }
122}
123
124unless ($PLATFORM eq 'win32' || $PLATFORM eq 'wince' || $PLATFORM eq 'MacOS' || $PLATFORM eq 'netware') {
125    open(CFG,$config_sh) || die "Cannot open $config_sh: $!\n";
126    while (<CFG>) {
127	if (/^(?:ccflags|optimize)='(.+)'$/) {
128	    $_ = $1;
129	    $define{$1} = 1 while /-D(\w+)/g;
130	}
131        if (/^(d_(?:mmap|sigaction))='(.+)'$/) {
132            $define{$1} = $2;
133        }
134	if ($PLATFORM eq 'os2') {
135	    $CONFIG_ARGS = $1 if /^config_args='(.+)'$/;
136	    $ARCHNAME =    $1 if /^archname='(.+)'$/;
137	    $PATCHLEVEL =  $1 if /^perl_patchlevel='(.+)'$/;
138	}
139    }
140    close(CFG);
141}
142if ($PLATFORM eq 'win32' || $PLATFORM eq 'wince') {
143    open(CFG,"<..\\$config_sh") || die "Cannot open ..\\$config_sh: $!\n";
144    if ((join '', <CFG>) =~ /^static_ext='(.*)'$/m) {
145        $static_ext = $1;
146    }
147    close(CFG);
148}
149
150open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
151while (<CFG>) {
152    $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
153    $define{$1} = 1 if /^\s*#\s*define\s+(MULTIPLICITY)\b/;
154    $define{$1} = 1 if /^\s*#\s*define\s+(PERL_\w+)\b/;
155    $define{$1} = 1 if /^\s*#\s*define\s+(USE_\w+)\b/;
156    $define{$1} = 1 if /^\s*#\s*define\s+(HAS_\w+)\b/;
157}
158close(CFG);
159
160# perl.h logic duplication begins
161
162if ($define{PERL_IMPLICIT_SYS}) {
163    $define{PL_OP_SLAB_ALLOC} = 1;
164}
165
166if ($define{USE_ITHREADS}) {
167    if (!$define{MULTIPLICITY}) {
168        $define{MULTIPLICITY} = 1;
169    }
170}
171
172$define{PERL_IMPLICIT_CONTEXT} ||=
173    $define{USE_ITHREADS} ||
174    $define{MULTIPLICITY} ;
175
176if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
177    $define{USE_REENTRANT_API} = 1;
178}
179
180# perl.h logic duplication ends
181
182my $sym_ord = 0;
183
184print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n";
185
186if ($PLATFORM =~ /^win(?:32|ce)$/) {
187    (my $dll = ($define{PERL_DLL} || "perl510")) =~ s/\.dll$//i;
188    print "LIBRARY $dll\n";
189    # The DESCRIPTION module definition file statement is not supported
190    # by VC7 onwards.
191    if ($CCTYPE !~ /^MSVC7/ && $CCTYPE !~ /^MSVC8/ && $CCTYPE !~ /^MSVC9/) {
192	print "DESCRIPTION 'Perl interpreter'\n";
193    }
194    print "EXPORTS\n";
195    if ($define{PERL_IMPLICIT_SYS}) {
196	output_symbol("perl_get_host_info");
197	output_symbol("perl_alloc_override");
198    }
199    if ($define{USE_ITHREADS} and $define{PERL_IMPLICIT_SYS}) {
200	output_symbol("perl_clone_host");
201    }
202}
203elsif ($PLATFORM eq 'os2') {
204    if (open my $fh, '<', 'perl5.def') {
205      while (<$fh>) {
206	last if /^\s*EXPORTS\b/;
207      }
208      while (<$fh>) {
209	$ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
210	# This allows skipping ordinals which were used in older versions
211	$sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
212      }
213      $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
214    }
215    (my $v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
216    $v .= '-thread' if $ARCHNAME =~ /-thread/;
217    (my $dll = $define{PERL_DLL}) =~ s/\.dll$//i;
218    $v .= "\@$PATCHLEVEL" if $PATCHLEVEL;
219    my $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $CONFIG_ARGS'";
220    $d = substr($d, 0, 249) . "...'" if length $d > 253;
221    print <<"---EOP---";
222LIBRARY '$dll' INITINSTANCE TERMINSTANCE
223$d
224STACKSIZE 32768
225CODE LOADONCALL
226DATA LOADONCALL NONSHARED MULTIPLE
227EXPORTS
228---EOP---
229}
230elsif ($PLATFORM eq 'aix') {
231    my $OSVER = `uname -v`;
232    chop $OSVER;
233    my $OSREL = `uname -r`;
234    chop $OSREL;
235    if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
236	print "#! ..\n";
237    } else {
238	print "#!\n";
239    }
240}
241elsif ($PLATFORM eq 'netware') {
242	if ($FILETYPE eq 'def') {
243	print "LIBRARY perl510\n";
244	print "DESCRIPTION 'Perl interpreter for NetWare'\n";
245	print "EXPORTS\n";
246	}
247	if ($define{PERL_IMPLICIT_SYS}) {
248	    output_symbol("perl_get_host_info");
249	    output_symbol("perl_alloc_override");
250	    output_symbol("perl_clone_host");
251	}
252}
253
254my %skip;
255my %export;
256
257sub skip_symbols {
258    my $list = shift;
259    foreach my $symbol (@$list) {
260	$skip{$symbol} = 1;
261    }
262}
263
264sub emit_symbols {
265    my $list = shift;
266    foreach my $symbol (@$list) {
267	my $skipsym = $symbol;
268	# XXX hack
269	if ($define{MULTIPLICITY}) {
270	    $skipsym =~ s/^Perl_[GIT](\w+)_ptr$/PL_$1/;
271	}
272	emit_symbol($symbol) unless exists $skip{$skipsym};
273    }
274}
275
276if ($PLATFORM eq 'win32') {
277    skip_symbols [qw(
278		     PL_statusvalue_vms
279		     PL_archpat_auto
280		     PL_cryptseen
281		     PL_DBcv
282		     PL_generation
283		     PL_lastgotoprobe
284		     PL_linestart
285		     PL_modcount
286		     PL_pending_ident
287		     PL_sublex_info
288		     PL_timesbuf
289		     main
290		     Perl_ErrorNo
291		     Perl_GetVars
292		     Perl_do_exec3
293		     Perl_do_ipcctl
294		     Perl_do_ipcget
295		     Perl_do_msgrcv
296		     Perl_do_msgsnd
297		     Perl_do_semop
298		     Perl_do_shmio
299		     Perl_dump_fds
300		     Perl_init_thread_intern
301		     Perl_my_bzero
302		     Perl_my_bcopy
303		     Perl_my_htonl
304		     Perl_my_ntohl
305		     Perl_my_swap
306		     Perl_my_chsize
307		     Perl_same_dirent
308		     Perl_setenv_getix
309		     Perl_unlnk
310		     Perl_watch
311		     Perl_safexcalloc
312		     Perl_safexmalloc
313		     Perl_safexfree
314		     Perl_safexrealloc
315		     Perl_my_memcmp
316		     Perl_my_memset
317		     PL_cshlen
318		     PL_cshname
319		     PL_opsave
320		     Perl_do_exec
321		     Perl_getenv_len
322		     Perl_my_pclose
323		     Perl_my_popen
324		     Perl_my_sprintf
325		     )];
326}
327else {
328    skip_symbols [qw(
329		     Perl_do_spawn
330		     Perl_do_spawn_nowait
331		     Perl_do_aspawn
332		     )];
333}
334if ($PLATFORM eq 'wince') {
335    skip_symbols [qw(
336		     PL_statusvalue_vms
337		     PL_archpat_auto
338		     PL_cryptseen
339		     PL_DBcv
340		     PL_generation
341		     PL_lastgotoprobe
342		     PL_linestart
343		     PL_modcount
344		     PL_pending_ident
345		     PL_sublex_info
346		     PL_timesbuf
347		     PL_collation_ix
348		     PL_collation_name
349		     PL_collation_standard
350		     PL_collxfrm_base
351		     PL_collxfrm_mult
352		     PL_numeric_compat1
353		     PL_numeric_local
354		     PL_numeric_name
355		     PL_numeric_radix_sv
356		     PL_numeric_standard
357		     PL_vtbl_collxfrm
358		     Perl_sv_collxfrm
359		     setgid
360		     setuid
361		     win32_free_childdir
362		     win32_free_childenv
363		     win32_get_childdir
364		     win32_get_childenv
365		     win32_spawnvp
366		     main
367		     Perl_ErrorNo
368		     Perl_GetVars
369		     Perl_do_exec3
370		     Perl_do_ipcctl
371		     Perl_do_ipcget
372		     Perl_do_msgrcv
373		     Perl_do_msgsnd
374		     Perl_do_semop
375		     Perl_do_shmio
376		     Perl_dump_fds
377		     Perl_init_thread_intern
378		     Perl_my_bzero
379		     Perl_my_bcopy
380		     Perl_my_htonl
381		     Perl_my_ntohl
382		     Perl_my_swap
383		     Perl_my_chsize
384		     Perl_same_dirent
385		     Perl_setenv_getix
386		     Perl_unlnk
387		     Perl_watch
388		     Perl_safexcalloc
389		     Perl_safexmalloc
390		     Perl_safexfree
391		     Perl_safexrealloc
392		     Perl_my_memcmp
393		     Perl_my_memset
394		     PL_cshlen
395		     PL_cshname
396		     PL_opsave
397		     Perl_do_exec
398		     Perl_getenv_len
399		     Perl_my_pclose
400		     Perl_my_popen
401		     Perl_my_sprintf
402		     )];
403}
404elsif ($PLATFORM eq 'aix') {
405    skip_symbols([qw(
406		     Perl_dump_fds
407		     Perl_ErrorNo
408		     Perl_GetVars
409		     Perl_my_bcopy
410		     Perl_my_bzero
411		     Perl_my_chsize
412		     Perl_my_htonl
413		     Perl_my_memcmp
414		     Perl_my_memset
415		     Perl_my_ntohl
416		     Perl_my_swap
417		     Perl_safexcalloc
418		     Perl_safexfree
419		     Perl_safexmalloc
420		     Perl_safexrealloc
421		     Perl_same_dirent
422		     Perl_unlnk
423		     Perl_sys_intern_clear
424		     Perl_sys_intern_dup
425		     Perl_sys_intern_init
426		     Perl_my_sprintf
427		     PL_cryptseen
428		     PL_opsave
429		     PL_statusvalue_vms
430		     PL_sys_intern
431		     )]);
432    skip_symbols([qw(
433		     Perl_signbit
434		     )])
435	if $define{'HAS_SIGNBIT'};
436    emit_symbols([qw(
437		     boot_DynaLoader
438		     )]);
439}
440elsif ($PLATFORM eq 'os2') {
441    emit_symbols([qw(
442		    ctermid
443		    get_sysinfo
444		    Perl_OS2_init
445		    Perl_OS2_init3
446		    Perl_OS2_term
447		    OS2_Perl_data
448		    dlopen
449		    dlsym
450		    dlerror
451		    dlclose
452		    dup2
453		    dup
454		    my_tmpfile
455		    my_tmpnam
456		    my_flock
457		    my_rmdir
458		    my_mkdir
459		    my_getpwuid
460		    my_getpwnam
461		    my_getpwent
462		    my_setpwent
463		    my_endpwent
464		    fork_with_resources
465		    croak_with_os2error
466		    setgrent
467		    endgrent
468		    getgrent
469		    malloc_mutex
470		    threads_mutex
471		    nthreads
472		    nthreads_cond
473		    os2_cond_wait
474		    os2_stat
475		    os2_execname
476		    async_mssleep
477		    msCounter
478		    InfoTable
479		    pthread_join
480		    pthread_create
481		    pthread_detach
482		    XS_Cwd_change_drive
483		    XS_Cwd_current_drive
484		    XS_Cwd_extLibpath
485		    XS_Cwd_extLibpath_set
486		    XS_Cwd_sys_abspath
487		    XS_Cwd_sys_chdir
488		    XS_Cwd_sys_cwd
489		    XS_Cwd_sys_is_absolute
490		    XS_Cwd_sys_is_relative
491		    XS_Cwd_sys_is_rooted
492		    XS_DynaLoader_mod2fname
493		    XS_File__Copy_syscopy
494		    Perl_Register_MQ
495		    Perl_Deregister_MQ
496		    Perl_Serve_Messages
497		    Perl_Process_Messages
498		    init_PMWIN_entries
499		    PMWIN_entries
500		    Perl_hab_GET
501		    loadByOrdinal
502		    pExtFCN
503		    os2error
504		    ResetWinError
505		    CroakWinError
506		    PL_do_undump
507		    )]);
508    emit_symbols([qw(os2_cond_wait
509		     pthread_join
510		     pthread_create
511		     pthread_detach
512		    )])
513      if $define{'USE_5005THREADS'} or $define{'USE_ITHREADS'};
514}
515elsif ($PLATFORM eq 'MacOS') {
516    skip_symbols [qw(
517		    Perl_GetVars
518		    PL_cryptseen
519		    PL_cshlen
520		    PL_cshname
521		    PL_statusvalue_vms
522		    PL_sys_intern
523		    PL_opsave
524		    PL_timesbuf
525		    Perl_dump_fds
526		    Perl_my_bcopy
527		    Perl_my_bzero
528		    Perl_my_chsize
529		    Perl_my_htonl
530		    Perl_my_memcmp
531		    Perl_my_memset
532		    Perl_my_ntohl
533		    Perl_my_swap
534		    Perl_safexcalloc
535		    Perl_safexfree
536		    Perl_safexmalloc
537		    Perl_safexrealloc
538		    Perl_unlnk
539		    Perl_sys_intern_clear
540		    Perl_sys_intern_init
541		    )];
542}
543elsif ($PLATFORM eq 'netware') {
544	skip_symbols [qw(
545			PL_statusvalue_vms
546			PL_archpat_auto
547			PL_cryptseen
548			PL_DBcv
549			PL_generation
550			PL_lastgotoprobe
551			PL_linestart
552			PL_modcount
553			PL_pending_ident
554			PL_sublex_info
555			PL_timesbuf
556			main
557			Perl_ErrorNo
558			Perl_GetVars
559			Perl_do_exec3
560			Perl_do_ipcctl
561			Perl_do_ipcget
562			Perl_do_msgrcv
563			Perl_do_msgsnd
564			Perl_do_semop
565			Perl_do_shmio
566			Perl_dump_fds
567			Perl_init_thread_intern
568			Perl_my_bzero
569			Perl_my_htonl
570			Perl_my_ntohl
571			Perl_my_swap
572			Perl_my_chsize
573			Perl_same_dirent
574			Perl_setenv_getix
575			Perl_unlnk
576			Perl_watch
577			Perl_safexcalloc
578			Perl_safexmalloc
579			Perl_safexfree
580			Perl_safexrealloc
581			Perl_my_memcmp
582			Perl_my_memset
583			PL_cshlen
584			PL_cshname
585			PL_opsave
586			Perl_do_exec
587			Perl_getenv_len
588			Perl_my_pclose
589			Perl_my_popen
590			Perl_sys_intern_init
591			Perl_sys_intern_dup
592			Perl_sys_intern_clear
593			Perl_my_bcopy
594			Perl_PerlIO_write
595			Perl_PerlIO_unread
596			Perl_PerlIO_tell
597			Perl_PerlIO_stdout
598			Perl_PerlIO_stdin
599			Perl_PerlIO_stderr
600			Perl_PerlIO_setlinebuf
601			Perl_PerlIO_set_ptrcnt
602			Perl_PerlIO_set_cnt
603			Perl_PerlIO_seek
604			Perl_PerlIO_read
605			Perl_PerlIO_get_ptr
606			Perl_PerlIO_get_cnt
607			Perl_PerlIO_get_bufsiz
608			Perl_PerlIO_get_base
609			Perl_PerlIO_flush
610			Perl_PerlIO_fill
611			Perl_PerlIO_fileno
612			Perl_PerlIO_error
613			Perl_PerlIO_eof
614			Perl_PerlIO_close
615			Perl_PerlIO_clearerr
616			PerlIO_perlio
617			)];
618}
619
620unless ($define{'DEBUGGING'}) {
621    skip_symbols [qw(
622		    Perl_deb_growlevel
623		    Perl_debop
624		    Perl_debprofdump
625		    Perl_debstack
626		    Perl_debstackptrs
627		    Perl_pad_sv
628		    Perl_hv_assert
629		    PL_block_type
630		    PL_watchaddr
631		    PL_watchok
632		    PL_watch_pvx
633		    )];
634}
635
636if ($define{'PERL_IMPLICIT_CONTEXT'}) {
637    skip_symbols [qw(
638		    PL_sig_sv
639		    )];
640}
641
642if ($define{'PERL_IMPLICIT_SYS'}) {
643    skip_symbols [qw(
644		    Perl_getenv_len
645		    Perl_my_popen
646		    Perl_my_pclose
647		    )];
648}
649else {
650    skip_symbols [qw(
651		    PL_Mem
652		    PL_MemShared
653		    PL_MemParse
654		    PL_Env
655		    PL_StdIO
656		    PL_LIO
657		    PL_Dir
658		    PL_Sock
659		    PL_Proc
660		    )];
661}
662
663unless ($define{'PERL_OLD_COPY_ON_WRITE'}) {
664    skip_symbols [qw(
665		    Perl_sv_setsv_cow
666		  )];
667}
668
669unless ($define{'USE_REENTRANT_API'}) {
670    skip_symbols [qw(
671		    PL_reentrant_buffer
672		    )];
673}
674
675if ($define{'MYMALLOC'}) {
676    emit_symbols [qw(
677		    Perl_dump_mstats
678		    Perl_get_mstats
679		    Perl_strdup
680		    Perl_putenv
681		    MallocCfg_ptr
682		    MallocCfgP_ptr
683		    )];
684    if ($define{'USE_ITHREADS'}) {
685	emit_symbols [qw(
686			PL_malloc_mutex
687			)];
688    }
689    else {
690	skip_symbols [qw(
691			PL_malloc_mutex
692			)];
693    }
694}
695else {
696    skip_symbols [qw(
697		    PL_malloc_mutex
698		    Perl_dump_mstats
699		    Perl_get_mstats
700		    Perl_malloced_size
701		    Perl_malloc_good_size
702		    MallocCfg_ptr
703		    MallocCfgP_ptr
704		    )];
705}
706
707if ($define{'PERL_USE_SAFE_PUTENV'}) {
708    skip_symbols [qw(
709                   PL_use_safe_putenv
710                  )];
711}
712
713unless ($define{'USE_ITHREADS'}) {
714    skip_symbols [qw(
715		    PL_thr_key
716		    )];
717}
718
719# USE_5005THREADS symbols. Kept as reference for easier removal
720    skip_symbols [qw(
721		    PL_sv_mutex
722		    PL_strtab_mutex
723		    PL_svref_mutex
724		    PL_cred_mutex
725		    PL_eval_mutex
726		    PL_fdpid_mutex
727		    PL_sv_lock_mutex
728		    PL_eval_cond
729		    PL_eval_owner
730		    PL_threads_mutex
731		    PL_nthreads
732		    PL_nthreads_cond
733		    PL_threadnum
734		    PL_threadsv_names
735		    PL_thrsv
736		    PL_vtbl_mutex
737		    Perl_condpair_magic
738		    Perl_new_struct_thread
739		    Perl_per_thread_magicals
740		    Perl_thread_create
741		    Perl_find_threadsv
742		    Perl_unlock_condpair
743		    Perl_magic_mutexfree
744		    Perl_sv_lock
745		    )];
746
747unless ($define{'USE_ITHREADS'}) {
748    skip_symbols [qw(
749		    PL_op_mutex
750		    PL_regex_pad
751		    PL_regex_padav
752		    PL_sharedsv_space
753		    PL_sharedsv_space_mutex
754		    PL_dollarzero_mutex
755		    PL_hints_mutex
756		    PL_perlio_mutex
757		    PL_regdupe
758		    Perl_parser_dup
759		    Perl_dirp_dup
760		    Perl_cx_dup
761		    Perl_si_dup
762		    Perl_any_dup
763		    Perl_ss_dup
764		    Perl_fp_dup
765		    Perl_gp_dup
766		    Perl_he_dup
767		    Perl_mg_dup
768		    Perl_mro_meta_dup
769		    Perl_re_dup
770		    Perl_sv_dup
771		    Perl_rvpv_dup
772		    Perl_hek_dup
773		    Perl_sys_intern_dup
774		    perl_clone
775		    perl_clone_using
776		    Perl_sharedsv_find
777		    Perl_sharedsv_init
778		    Perl_sharedsv_lock
779		    Perl_sharedsv_new
780		    Perl_sharedsv_thrcnt_dec
781		    Perl_sharedsv_thrcnt_inc
782		    Perl_sharedsv_unlock
783		    Perl_stashpv_hvname_match
784		    Perl_regdupe_internal
785		    Perl_newPADOP
786		    )];
787}
788
789unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
790    skip_symbols [qw(
791		    PL_my_ctx_mutex
792		    PL_my_cxt_index
793		    PL_my_cxt_list
794		    PL_my_cxt_size
795		    PL_my_cxt_keys
796		    Perl_croak_nocontext
797		    Perl_die_nocontext
798		    Perl_deb_nocontext
799		    Perl_form_nocontext
800		    Perl_load_module_nocontext
801		    Perl_mess_nocontext
802		    Perl_warn_nocontext
803		    Perl_warner_nocontext
804		    Perl_newSVpvf_nocontext
805		    Perl_sv_catpvf_nocontext
806		    Perl_sv_setpvf_nocontext
807		    Perl_sv_catpvf_mg_nocontext
808		    Perl_sv_setpvf_mg_nocontext
809		    Perl_my_cxt_init
810		    Perl_my_cxt_index
811		    )];
812}
813
814unless ($define{'PERL_IMPLICIT_SYS'}) {
815    skip_symbols [qw(
816		    perl_alloc_using
817		    perl_clone_using
818		    )];
819}
820
821unless ($define{'FAKE_THREADS'}) {
822    skip_symbols [qw(PL_curthr)];
823}
824
825unless ($define{'PL_OP_SLAB_ALLOC'}) {
826    skip_symbols [qw(
827                     PL_OpPtr
828                     PL_OpSlab
829                     PL_OpSpace
830		     Perl_Slab_Alloc
831		     Perl_Slab_Free
832                    )];
833}
834
835unless ($define{'PERL_DEBUG_READONLY_OPS'}) {
836    skip_symbols [qw(
837		    PL_slab_count
838		    PL_slabs
839                  )];
840}
841
842unless ($define{'THREADS_HAVE_PIDS'}) {
843    skip_symbols [qw(PL_ppid)];
844}
845
846unless ($define{'PERL_NEED_APPCTX'}) {
847    skip_symbols [qw(
848		    PL_appctx
849		    )];
850}
851
852unless ($define{'PERL_NEED_TIMESBASE'}) {
853    skip_symbols [qw(
854		    PL_timesbase
855		    )];
856}
857
858unless ($define{'DEBUG_LEAKING_SCALARS'}) {
859    skip_symbols [qw(
860		    PL_sv_serial
861		    )];
862}
863
864unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
865    skip_symbols [qw(
866		    PL_dumper_fd
867		    )];
868}
869unless ($define{'PERL_DONT_CREATE_GVSV'}) {
870    skip_symbols [qw(
871		     Perl_gv_SVadd
872		    )];
873}
874if ($define{'SPRINTF_RETURNS_STRLEN'}) {
875    skip_symbols [qw(
876		     Perl_my_sprintf
877		    )];
878}
879unless ($define{'PERL_USES_PL_PIDSTATUS'}) {
880    skip_symbols [qw(
881		     Perl_pidgone
882		     PL_pidstatus
883		    )];
884}
885
886unless ($define{'PERL_TRACK_MEMPOOL'}) {
887    skip_symbols [qw(
888                     PL_memory_debug_header
889                    )];
890}
891
892if ($define{'PERL_MAD'}) {
893    skip_symbols [qw(
894		     PL_nextval
895		     PL_nexttype
896		     )];
897} else {
898    skip_symbols [qw(
899		    PL_madskills
900		    PL_xmlfp
901		    PL_lasttoke
902		    PL_realtokenstart
903		    PL_faketokens
904		    PL_thismad
905		    PL_thistoken
906		    PL_thisopen
907		    PL_thisstuff
908		    PL_thisclose
909		    PL_thiswhite
910		    PL_nextwhite
911		    PL_skipwhite
912		    PL_endwhite
913		    PL_curforce
914		    Perl_pad_peg
915		    Perl_xmldump_indent
916		    Perl_xmldump_vindent
917		    Perl_xmldump_all
918		    Perl_xmldump_packsubs
919		    Perl_xmldump_sub
920		    Perl_xmldump_form
921		    Perl_xmldump_eval
922		    Perl_sv_catxmlsv
923		    Perl_sv_catxmlpvn
924		    Perl_sv_xmlpeek
925		    Perl_do_pmop_xmldump
926		    Perl_pmop_xmldump
927		    Perl_do_op_xmldump
928		    Perl_op_xmldump
929		    )];
930}
931
932unless ($define{'MULTIPLICITY'}) {
933    skip_symbols [qw(
934		    PL_interp_size
935		    PL_interp_size_5_10_0
936		    )];
937}
938
939unless ($define{'PERL_GLOBAL_STRUCT'}) {
940    skip_symbols [qw(
941		    PL_global_struct_size
942		    )];
943}
944
945unless ($define{'PERL_GLOBAL_STRUCT_PRIVATE'}) {
946    skip_symbols [qw(
947		    PL_my_cxt_keys
948		    Perl_my_cxt_index
949		    )];
950}
951
952unless ($define{'d_mmap'}) {
953    skip_symbols [qw(
954		    PL_mmap_page_size
955		    )];
956}
957
958if ($define{'d_sigaction'}) {
959    skip_symbols [qw(
960		    PL_sig_trapped
961		    )];
962}
963
964if ($^O ne 'vms') {
965    # VMS does its own thing for these symbols.
966    skip_symbols [qw(PL_sig_handlers_initted
967                     PL_sig_ignoring
968                     PL_sig_defaulting)];
969}
970
971sub readvar {
972    my $file = shift;
973    my $proc = shift || sub { "PL_$_[2]" };
974    open(VARS,$file) || die "Cannot open $file: $!\n";
975    my @syms;
976    while (<VARS>) {
977	# All symbols have a Perl_ prefix because that's what embed.h
978	# sticks in front of them.  The A?I?S?C? is strictly speaking
979	# wrong.
980	push(@syms, &$proc($1,$2,$3)) if (/\bPERLVAR(A?I?S?C?)\(([IGT])(\w+)/);
981    }
982    close(VARS);
983    return \@syms;
984}
985
986if ($define{'PERL_GLOBAL_STRUCT'}) {
987    my $global = readvar($perlvars_h);
988    skip_symbols $global;
989    emit_symbol('Perl_GetVars');
990    emit_symbols [qw(PL_Vars PL_VarsPtr)] unless $CCTYPE eq 'GCC';
991} else {
992    skip_symbols [qw(Perl_init_global_struct Perl_free_global_struct)];
993}
994
995# functions from *.sym files
996
997my @syms = ($global_sym, $globvar_sym); # $pp_sym is not part of the API
998
999# Symbols that are the public face of the PerlIO layers implementation
1000# These are in _addition to_ the public face of the abstraction
1001# and need to be exported to allow XS modules to implement layers
1002my @layer_syms = qw(
1003		    PerlIOBase_binmode
1004		    PerlIOBase_clearerr
1005		    PerlIOBase_close
1006		    PerlIOBase_dup
1007		    PerlIOBase_eof
1008		    PerlIOBase_error
1009		    PerlIOBase_fileno
1010		    PerlIOBase_noop_fail
1011		    PerlIOBase_noop_ok
1012		    PerlIOBase_popped
1013		    PerlIOBase_pushed
1014		    PerlIOBase_read
1015		    PerlIOBase_setlinebuf
1016		    PerlIOBase_unread
1017		    PerlIOBuf_bufsiz
1018		    PerlIOBuf_close
1019		    PerlIOBuf_dup
1020		    PerlIOBuf_fill
1021		    PerlIOBuf_flush
1022		    PerlIOBuf_get_base
1023		    PerlIOBuf_get_cnt
1024		    PerlIOBuf_get_ptr
1025		    PerlIOBuf_open
1026		    PerlIOBuf_popped
1027		    PerlIOBuf_pushed
1028		    PerlIOBuf_read
1029		    PerlIOBuf_seek
1030		    PerlIOBuf_set_ptrcnt
1031		    PerlIOBuf_tell
1032		    PerlIOBuf_unread
1033		    PerlIOBuf_write
1034		    PerlIO_allocate
1035		    PerlIO_apply_layera
1036		    PerlIO_apply_layers
1037		    PerlIO_arg_fetch
1038		    PerlIO_debug
1039		    PerlIO_define_layer
1040		    PerlIO_find_layer
1041		    PerlIO_isutf8
1042		    PerlIO_layer_fetch
1043		    PerlIO_list_alloc
1044		    PerlIO_list_free
1045		    PerlIO_modestr
1046		    PerlIO_parse_layers
1047		    PerlIO_pending
1048		    PerlIO_perlio
1049		    PerlIO_pop
1050		    PerlIO_push
1051		    PerlIO_sv_dup
1052		    Perl_PerlIO_clearerr
1053		    Perl_PerlIO_close
1054		    Perl_PerlIO_context_layers
1055		    Perl_PerlIO_eof
1056		    Perl_PerlIO_error
1057		    Perl_PerlIO_fileno
1058		    Perl_PerlIO_fill
1059		    Perl_PerlIO_flush
1060		    Perl_PerlIO_get_base
1061		    Perl_PerlIO_get_bufsiz
1062		    Perl_PerlIO_get_cnt
1063		    Perl_PerlIO_get_ptr
1064		    Perl_PerlIO_read
1065		    Perl_PerlIO_seek
1066		    Perl_PerlIO_set_cnt
1067		    Perl_PerlIO_set_ptrcnt
1068		    Perl_PerlIO_setlinebuf
1069		    Perl_PerlIO_stderr
1070		    Perl_PerlIO_stdin
1071		    Perl_PerlIO_stdout
1072		    Perl_PerlIO_tell
1073		    Perl_PerlIO_unread
1074		    Perl_PerlIO_write
1075);
1076if ($PLATFORM eq 'netware') {
1077    push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
1078}
1079
1080if ($define{'USE_PERLIO'}) {
1081    # Export the symols that make up the PerlIO abstraction, regardless
1082    # of its implementation - read from a file
1083    push @syms, $perlio_sym;
1084
1085    # This part is then dependent on how the abstraction is implemented
1086    if ($define{'USE_SFIO'}) {
1087	# Old legacy non-stdio "PerlIO"
1088	skip_symbols \@layer_syms;
1089	skip_symbols [qw(perlsio_binmode)];
1090	# SFIO defines most of the PerlIO routines as macros
1091	# So undo most of what $perlio_sym has just done - d'oh !
1092	# Perhaps it would be better to list the ones which do exist
1093	# And emit them
1094	skip_symbols [qw(
1095			 PerlIO_canset_cnt
1096			 PerlIO_clearerr
1097			 PerlIO_close
1098			 PerlIO_eof
1099			 PerlIO_error
1100			 PerlIO_exportFILE
1101			 PerlIO_fast_gets
1102			 PerlIO_fdopen
1103			 PerlIO_fileno
1104			 PerlIO_findFILE
1105			 PerlIO_flush
1106			 PerlIO_get_base
1107			 PerlIO_get_bufsiz
1108			 PerlIO_get_cnt
1109			 PerlIO_get_ptr
1110			 PerlIO_getc
1111			 PerlIO_getname
1112			 PerlIO_has_base
1113			 PerlIO_has_cntptr
1114			 PerlIO_importFILE
1115			 PerlIO_open
1116			 PerlIO_printf
1117			 PerlIO_putc
1118			 PerlIO_puts
1119			 PerlIO_read
1120			 PerlIO_releaseFILE
1121			 PerlIO_reopen
1122			 PerlIO_rewind
1123			 PerlIO_seek
1124			 PerlIO_set_cnt
1125			 PerlIO_set_ptrcnt
1126			 PerlIO_setlinebuf
1127			 PerlIO_sprintf
1128			 PerlIO_stderr
1129			 PerlIO_stdin
1130			 PerlIO_stdout
1131			 PerlIO_stdoutf
1132			 PerlIO_tell
1133			 PerlIO_ungetc
1134			 PerlIO_vprintf
1135			 PerlIO_write
1136			 PerlIO_perlio
1137			 Perl_PerlIO_clearerr
1138			 Perl_PerlIO_close
1139			 Perl_PerlIO_eof
1140			 Perl_PerlIO_error
1141			 Perl_PerlIO_fileno
1142			 Perl_PerlIO_fill
1143			 Perl_PerlIO_flush
1144			 Perl_PerlIO_get_base
1145			 Perl_PerlIO_get_bufsiz
1146			 Perl_PerlIO_get_cnt
1147			 Perl_PerlIO_get_ptr
1148			 Perl_PerlIO_read
1149			 Perl_PerlIO_seek
1150			 Perl_PerlIO_set_cnt
1151			 Perl_PerlIO_set_ptrcnt
1152			 Perl_PerlIO_setlinebuf
1153			 Perl_PerlIO_stderr
1154			 Perl_PerlIO_stdin
1155			 Perl_PerlIO_stdout
1156			 Perl_PerlIO_tell
1157			 Perl_PerlIO_unread
1158			 Perl_PerlIO_write
1159                         PL_def_layerlist
1160                         PL_known_layers
1161                         PL_perlio
1162			 )];
1163    }
1164    else {
1165	# PerlIO with layers - export implementation
1166	emit_symbols \@layer_syms;
1167	emit_symbols [qw(perlsio_binmode)];
1168    }
1169    if ($define{'USE_ITHREADS'}) {
1170	emit_symbols [qw(
1171			PL_perlio_mutex
1172			)];
1173    }
1174    else {
1175	skip_symbols [qw(
1176			PL_perlio_mutex
1177			)];
1178    }
1179} else {
1180	# -Uuseperlio
1181	# Skip the PerlIO layer symbols - although
1182	# nothing should have exported them anyway.
1183	skip_symbols \@layer_syms;
1184	skip_symbols [qw(
1185			perlsio_binmode
1186			PL_def_layerlist
1187			PL_known_layers
1188			PL_perlio
1189			PL_perlio_debug_fd
1190			PL_perlio_fd_refcnt
1191			PL_perlio_fd_refcnt_size
1192			)];
1193
1194	# Also do NOT add abstraction symbols from $perlio_sym
1195	# abstraction is done as #define to stdio
1196	# Remaining remnants that _may_ be functions
1197	# are handled in <DATA>
1198}
1199
1200for my $syms (@syms) {
1201    open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
1202    while (<GLOBAL>) {
1203	next if (!/^[A-Za-z]/);
1204	# Functions have a Perl_ prefix
1205	# Variables have a PL_ prefix
1206	chomp($_);
1207	my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
1208	$symbol .= $_;
1209	emit_symbol($symbol) unless exists $skip{$symbol};
1210    }
1211    close(GLOBAL);
1212}
1213
1214# variables
1215
1216if ($define{'MULTIPLICITY'}) {
1217    for my $f ($perlvars_h, $intrpvar_h) {
1218	my $glob = readvar($f, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
1219	emit_symbols $glob;
1220    }
1221    # XXX AIX seems to want the perlvars.h symbols, for some reason
1222    if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') {	# OS/2 needs PL_thr_key
1223	my $glob = readvar($perlvars_h);
1224	emit_symbols $glob;
1225    }
1226}
1227else {
1228    unless ($define{'PERL_GLOBAL_STRUCT'}) {
1229	my $glob = readvar($perlvars_h);
1230	emit_symbols $glob;
1231    }
1232    unless ($define{'MULTIPLICITY'}) {
1233	my $glob = readvar($intrpvar_h);
1234	emit_symbols $glob;
1235    }
1236}
1237
1238sub try_symbol {
1239    my $symbol = shift;
1240
1241    return if $symbol !~ /^[A-Za-z_]/;
1242    return if $symbol =~ /^\#/;
1243    $symbol =~s/\r//g;
1244    chomp($symbol);
1245    return if exists $skip{$symbol};
1246    emit_symbol($symbol);
1247}
1248
1249while (<DATA>) {
1250    try_symbol($_);
1251}
1252
1253if ($PLATFORM =~ /^win(?:32|ce)$/) {
1254    foreach my $symbol (qw(
1255			    setuid
1256			    setgid
1257			    boot_DynaLoader
1258			    Perl_init_os_extras
1259			    Perl_thread_create
1260			    Perl_win32_init
1261			    Perl_win32_term
1262			    RunPerl
1263			    win32_async_check
1264			    win32_errno
1265			    win32_environ
1266			    win32_abort
1267			    win32_fstat
1268			    win32_stat
1269			    win32_pipe
1270			    win32_popen
1271			    win32_pclose
1272			    win32_rename
1273			    win32_setmode
1274			    win32_chsize
1275			    win32_lseek
1276			    win32_tell
1277			    win32_dup
1278			    win32_dup2
1279			    win32_open
1280			    win32_close
1281			    win32_eof
1282			    win32_read
1283			    win32_write
1284			    win32_spawnvp
1285			    win32_mkdir
1286			    win32_rmdir
1287			    win32_chdir
1288			    win32_flock
1289			    win32_execv
1290			    win32_execvp
1291			    win32_htons
1292			    win32_ntohs
1293			    win32_htonl
1294			    win32_ntohl
1295			    win32_inet_addr
1296			    win32_inet_ntoa
1297			    win32_socket
1298			    win32_bind
1299			    win32_listen
1300			    win32_accept
1301			    win32_connect
1302			    win32_send
1303			    win32_sendto
1304			    win32_recv
1305			    win32_recvfrom
1306			    win32_shutdown
1307			    win32_closesocket
1308			    win32_ioctlsocket
1309			    win32_setsockopt
1310			    win32_getsockopt
1311			    win32_getpeername
1312			    win32_getsockname
1313			    win32_gethostname
1314			    win32_gethostbyname
1315			    win32_gethostbyaddr
1316			    win32_getprotobyname
1317			    win32_getprotobynumber
1318			    win32_getservbyname
1319			    win32_getservbyport
1320			    win32_select
1321			    win32_endhostent
1322			    win32_endnetent
1323			    win32_endprotoent
1324			    win32_endservent
1325			    win32_getnetent
1326			    win32_getnetbyname
1327			    win32_getnetbyaddr
1328			    win32_getprotoent
1329			    win32_getservent
1330			    win32_sethostent
1331			    win32_setnetent
1332			    win32_setprotoent
1333			    win32_setservent
1334			    win32_getenv
1335			    win32_putenv
1336			    win32_perror
1337			    win32_malloc
1338			    win32_calloc
1339			    win32_realloc
1340			    win32_free
1341			    win32_sleep
1342			    win32_times
1343			    win32_access
1344			    win32_alarm
1345			    win32_chmod
1346			    win32_open_osfhandle
1347			    win32_get_osfhandle
1348			    win32_ioctl
1349			    win32_link
1350			    win32_unlink
1351			    win32_utime
1352			    win32_gettimeofday
1353			    win32_uname
1354			    win32_wait
1355			    win32_waitpid
1356			    win32_kill
1357			    win32_str_os_error
1358			    win32_opendir
1359			    win32_readdir
1360			    win32_telldir
1361			    win32_seekdir
1362			    win32_rewinddir
1363			    win32_closedir
1364			    win32_longpath
1365			    win32_ansipath
1366			    win32_os_id
1367			    win32_getpid
1368			    win32_crypt
1369			    win32_dynaload
1370			    win32_get_childenv
1371			    win32_free_childenv
1372			    win32_clearenv
1373			    win32_get_childdir
1374			    win32_free_childdir
1375			    win32_stdin
1376			    win32_stdout
1377			    win32_stderr
1378			    win32_ferror
1379			    win32_feof
1380			    win32_strerror
1381			    win32_fprintf
1382			    win32_printf
1383			    win32_vfprintf
1384			    win32_vprintf
1385			    win32_fread
1386			    win32_fwrite
1387			    win32_fopen
1388			    win32_fdopen
1389			    win32_freopen
1390			    win32_fclose
1391			    win32_fputs
1392			    win32_fputc
1393			    win32_ungetc
1394			    win32_getc
1395			    win32_fileno
1396			    win32_clearerr
1397			    win32_fflush
1398			    win32_ftell
1399			    win32_fseek
1400			    win32_fgetpos
1401			    win32_fsetpos
1402			    win32_rewind
1403			    win32_tmpfile
1404			    win32_setbuf
1405			    win32_setvbuf
1406			    win32_flushall
1407			    win32_fcloseall
1408			    win32_fgets
1409			    win32_gets
1410			    win32_fgetc
1411			    win32_putc
1412			    win32_puts
1413			    win32_getchar
1414			    win32_putchar
1415			   ))
1416    {
1417	try_symbol($symbol);
1418    }
1419    if ($CCTYPE eq "BORLAND") {
1420	try_symbol('_matherr');
1421    }
1422}
1423elsif ($PLATFORM eq 'os2') {
1424    my (%mapped, @missing);
1425    open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1426    /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1427    close MAP or die 'Cannot close miniperl.map';
1428
1429    @missing = grep { !exists $mapped{$_} }
1430		    keys %export;
1431    @missing = grep { !exists $exportperlmalloc{$_} } @missing;
1432    delete $export{$_} foreach @missing;
1433}
1434elsif ($PLATFORM eq 'MacOS') {
1435    open MACSYMS, 'macperl.sym' or die 'Cannot read macperl.sym';
1436
1437    while (<MACSYMS>) {
1438	try_symbol($_);
1439    }
1440
1441    close MACSYMS;
1442}
1443elsif ($PLATFORM eq 'netware') {
1444foreach my $symbol (qw(
1445			boot_DynaLoader
1446			Perl_init_os_extras
1447			Perl_thread_create
1448			Perl_nw5_init
1449			RunPerl
1450			AllocStdPerl
1451			FreeStdPerl
1452			do_spawn2
1453			do_aspawn
1454			nw_uname
1455			nw_stdin
1456			nw_stdout
1457			nw_stderr
1458			nw_feof
1459			nw_ferror
1460			nw_fopen
1461			nw_fclose
1462			nw_clearerr
1463			nw_getc
1464			nw_fgets
1465			nw_fputc
1466			nw_fputs
1467			nw_fflush
1468			nw_ungetc
1469			nw_fileno
1470			nw_fdopen
1471			nw_freopen
1472			nw_fread
1473			nw_fwrite
1474			nw_setbuf
1475			nw_setvbuf
1476			nw_vfprintf
1477			nw_ftell
1478			nw_fseek
1479			nw_rewind
1480			nw_tmpfile
1481			nw_fgetpos
1482			nw_fsetpos
1483			nw_dup
1484			nw_access
1485			nw_chmod
1486			nw_chsize
1487			nw_close
1488			nw_dup2
1489			nw_flock
1490			nw_isatty
1491			nw_link
1492			nw_lseek
1493			nw_stat
1494			nw_mktemp
1495			nw_open
1496			nw_read
1497			nw_rename
1498			nw_setmode
1499			nw_unlink
1500			nw_utime
1501			nw_write
1502			nw_chdir
1503			nw_rmdir
1504			nw_closedir
1505			nw_opendir
1506			nw_readdir
1507			nw_rewinddir
1508			nw_seekdir
1509			nw_telldir
1510			nw_htonl
1511			nw_htons
1512			nw_ntohl
1513			nw_ntohs
1514			nw_accept
1515			nw_bind
1516			nw_connect
1517			nw_endhostent
1518			nw_endnetent
1519			nw_endprotoent
1520			nw_endservent
1521			nw_gethostbyaddr
1522			nw_gethostbyname
1523			nw_gethostent
1524			nw_gethostname
1525			nw_getnetbyaddr
1526			nw_getnetbyname
1527			nw_getnetent
1528			nw_getpeername
1529			nw_getprotobyname
1530			nw_getprotobynumber
1531			nw_getprotoent
1532			nw_getservbyname
1533			nw_getservbyport
1534			nw_getservent
1535			nw_getsockname
1536			nw_getsockopt
1537			nw_inet_addr
1538			nw_listen
1539			nw_socket
1540			nw_recv
1541			nw_recvfrom
1542			nw_select
1543			nw_send
1544			nw_sendto
1545			nw_sethostent
1546			nw_setnetent
1547			nw_setprotoent
1548			nw_setservent
1549			nw_setsockopt
1550			nw_inet_ntoa
1551			nw_shutdown
1552			nw_crypt
1553			nw_execvp
1554			nw_kill
1555			nw_Popen
1556			nw_Pclose
1557			nw_Pipe
1558			nw_times
1559			nw_waitpid
1560			nw_getpid
1561			nw_spawnvp
1562			nw_os_id
1563			nw_open_osfhandle
1564			nw_get_osfhandle
1565			nw_abort
1566			nw_sleep
1567			nw_wait
1568			nw_dynaload
1569			nw_strerror
1570			fnFpSetMode
1571			fnInsertHashListAddrs
1572			fnGetHashListAddrs
1573			Perl_deb
1574			Perl_sv_setsv
1575			Perl_sv_catsv
1576			Perl_sv_catpvn
1577			Perl_sv_2pv
1578			nw_freeenviron
1579			Remove_Thread_Ctx
1580			   ))
1581    {
1582	try_symbol($symbol);
1583    }
1584}
1585
1586# records of type boot_module for statically linked modules (except Dynaloader)
1587$static_ext =~ s/\//__/g;
1588$static_ext =~ s/\bDynaLoader\b//;
1589my @stat_mods = map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext;
1590foreach my $symbol (@stat_mods)
1591    {
1592	try_symbol($symbol);
1593    }
1594
1595try_symbol("init_Win32CORE") if $static_ext =~ /\bWin32CORE\b/;
1596
1597# Now all symbols should be defined because
1598# next we are going to output them.
1599
1600foreach my $symbol (sort keys %export) {
1601    output_symbol($symbol);
1602}
1603
1604if ($PLATFORM eq 'os2') {
1605	print <<EOP;
1606    dll_perlmain=main
1607    fill_extLibpath
1608    dir_subst
1609    Perl_OS2_handler_install
1610
1611; LAST_ORDINAL=$sym_ord
1612EOP
1613}
1614
1615sub emit_symbol {
1616    my $symbol = shift;
1617    chomp($symbol);
1618    $export{$symbol} = 1;
1619}
1620
1621sub output_symbol {
1622    my $symbol = shift;
1623    if ($PLATFORM =~ /^win(?:32|ce)$/) {
1624	$symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
1625	print "\t$symbol\n";
1626# XXX: binary compatibility between compilers is an exercise
1627# in frustration :-(
1628#        if ($CCTYPE eq "BORLAND") {
1629#	    # workaround Borland quirk by exporting both the straight
1630#	    # name and a name with leading underscore.  Note the
1631#	    # alias *must* come after the symbol itself, if both
1632#	    # are to be exported. (Linker bug?)
1633#	    print "\t_$symbol\n";
1634#	    print "\t$symbol = _$symbol\n";
1635#	}
1636#	elsif ($CCTYPE eq 'GCC') {
1637#	    # Symbols have leading _ whole process is $%@"% slow
1638#	    # so skip aliases for now
1639#	    nprint "\t$symbol\n";
1640#	}
1641#	else {
1642#	    # for binary coexistence, export both the symbol and
1643#	    # alias with leading underscore
1644#	    print "\t$symbol\n";
1645#	    print "\t_$symbol = $symbol\n";
1646#	}
1647    }
1648    elsif ($PLATFORM eq 'os2') {
1649	printf qq(    %-31s \@%s\n),
1650	  qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
1651	printf qq(    %-31s \@%s\n),
1652	  qq("$exportperlmalloc{$symbol}" = "$symbol"),
1653	  $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1654	  if $exportperlmalloc and exists $exportperlmalloc{$symbol};
1655    }
1656    elsif ($PLATFORM eq 'aix' || $PLATFORM eq 'MacOS') {
1657	print "$symbol\n";
1658    }
1659	elsif ($PLATFORM eq 'netware') {
1660	print "\t$symbol,\n";
1661	}
1662}
1663
16641;
1665__DATA__
1666# Oddities from PerlIO
1667PerlIO_binmode
1668PerlIO_getpos
1669PerlIO_init
1670PerlIO_setpos
1671PerlIO_sprintf
1672PerlIO_sv_dup
1673PerlIO_tmpfile
1674PerlIO_vsprintf
1675