This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In makedef.pl, consolidate all the C compiler flags parsing code.
[perl5.git] / makedef.pl
CommitLineData
3df97b6d 1#./perl -w
549a6b10
JH
2#
3# Create the export list for perl.
4#
86593e8d
JH
5# Needed by WIN32 and OS/2 for creating perl.dll,
6# and by AIX for creating libperl.a when -Dusershrplib is in effect,
93ea32b8 7# and by VMS for creating perlshr.exe.
549a6b10 8#
3523994b
DM
9# Reads from information stored in
10#
208d7614 11# %Config::Config (ie config.sh)
3523994b 12# config.h
3523994b
DM
13# global.sym
14# globvar.sym
15# intrpvar.h
3523994b
DM
16# miniperl.map (on OS/2)
17# perl5.def (on OS/2; this is the old version of the file being made)
18# perlio.sym
19# perlvars.h
20#
bf09e1bd 21# plus long lists of function names hard-coded directly in this script.
3523994b
DM
22#
23# Writes the result to STDOUT.
24#
25# Normally this script is invoked from a makefile (e.g. win32/Makefile),
26# which redirects STDOUT to a suitable file, such as:
27#
28# perl5.def OS/2
29# perldll.def Windows
30# perl.exp AIX
31# perl.imp NetWare
93ea32b8 32# makedef.lis VMS
c560d966
RGS
33
34BEGIN { unshift @INC, "lib" }
9d6c7f2e 35use Config;
3df97b6d 36use strict;
0a753a76 37
c85dd27b 38use vars qw($PLATFORM $CCTYPE $FILETYPE $TARG_DIR);
080c3729 39
ca51b52d 40$CCTYPE = 'MSVC';
080c3729 41$TARG_DIR = '';
3df97b6d 42
d6035849 43my %define;
910dfcc8 44
c1b34f5f
NC
45sub process_cc_flags {
46 foreach (map {split /\s+/, $_} @_) {
47 $define{$1} = $2 // 1 if /^-D(\w+)(?:=(.+))?/;
48 }
49}
50
7766f137
GS
51while (@ARGV) {
52 my $flag = shift;
c1b34f5f
NC
53 if ($flag =~ /^(?:CC_FLAGS=)?(-D\w.*)/) {
54 process_cc_flags($1);
5c728af0
IZ
55 next;
56 }
7766f137
GS
57 $CCTYPE = $1 if ($flag =~ /^CCTYPE=(\w+)$/);
58 $PLATFORM = $1 if ($flag =~ /^PLATFORM=(\w+)$/);
3ea85c23 59 $FILETYPE = $1 if ($flag =~ /^FILETYPE=(\w+)$/);
080c3729 60 $TARG_DIR = $1 if $flag =~ /^TARG_DIR=(.+)$/;
7766f137 61}
d55594ae 62
93ea32b8 63my @PLATFORM = qw(aix win32 wince os2 netware vms);
549a6b10
JH
64my %PLATFORM;
65@PLATFORM{@PLATFORM} = ();
66
67defined $PLATFORM || die "PLATFORM undefined, must be one of: @PLATFORM\n";
9df9a5cd 68exists $PLATFORM{$PLATFORM} || die "PLATFORM must be one of: @PLATFORM\n";
549a6b10 69
208d7614
NC
70# Is the following guard strictly necessary? Added during refactoring
71# to keep the same behaviour when merging other code into here.
c1b34f5f
NC
72process_cc_flags(@Config{qw(ccflags optimize)})
73 if $PLATFORM ne 'win32' && $PLATFORM ne 'wince' && $PLATFORM ne 'netware';
208d7614 74
c960bcfd
NC
75# Add the compile-time options that miniperl was built with to %define.
76# On Win32 these are not the same options as perl itself will be built
77# with since miniperl is built with a canned config (one of the win32/
78# config_H.*) and none of the BUILDOPT's that are set in the makefiles,
79# but they do include some #define's that are hard-coded in various
80# source files and header files and don't include any BUILDOPT's that
81# the user might have chosen to disable because the canned configs are
82# minimal configs that don't include any of those options.
83
84my @options = sort(Config::bincompat_options(), Config::non_bincompat_options());
85print STDERR "Options: (@options)\n";
86$define{$_} = 1 foreach @options;
17bdc114 87
c6261f3b
JH
88my %exportperlmalloc =
89 (
90 Perl_malloc => "malloc",
91 Perl_mfree => "free",
92 Perl_realloc => "realloc",
93 Perl_calloc => "calloc",
94 );
95
96my $exportperlmalloc = $PLATFORM eq 'os2';
97
549a6b10 98my $config_h = "config.h";
549a6b10
JH
99my $intrpvar_h = "intrpvar.h";
100my $perlvars_h = "perlvars.h";
101my $global_sym = "global.sym";
549a6b10
JH
102my $globvar_sym = "globvar.sym";
103my $perlio_sym = "perlio.sym";
104
ca51b52d 105s/^/$TARG_DIR/ foreach($intrpvar_h, $perlvars_h, $global_sym, $globvar_sym,
208d7614 106 $perlio_sym);
549a6b10
JH
107
108open(CFG,$config_h) || die "Cannot open $config_h: $!\n";
7766f137 109while (<CFG>) {
1f0041ed 110 $define{$1} = 1 if /^\s*\#\s*define\s+(MYMALLOC|MULTIPLICITY
918a61c7 111 |SPRINTF_RETURNS_STRLEN
1f0041ed 112 |(?:PERL|USE|HAS)_\w+)\b/x;
7766f137 113}
bbc8f9de
NIS
114close(CFG);
115
18c4b137
JH
116# perl.h logic duplication begins
117
894ccb8c
JH
118if ($define{PERL_IMPLICIT_SYS}) {
119 $define{PL_OP_SLAB_ALLOC} = 1;
120}
ac6bedea 121
18c4b137 122if ($define{USE_ITHREADS}) {
acfe0abc 123 if (!$define{MULTIPLICITY}) {
18c4b137
JH
124 $define{MULTIPLICITY} = 1;
125 }
126}
127
128$define{PERL_IMPLICIT_CONTEXT} ||=
129 $define{USE_ITHREADS} ||
18c4b137
JH
130 $define{MULTIPLICITY} ;
131
10bc17b6
JH
132if ($define{USE_ITHREADS} && $PLATFORM ne 'win32' && $^O ne 'darwin') {
133 $define{USE_REENTRANT_API} = 1;
134}
135
18c4b137
JH
136# perl.h logic duplication ends
137
dcddf0a3
SH
138print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n";
139
d6035849
NC
140my $sym_ord = 0;
141my %ordinal;
142
143if ($PLATFORM eq 'os2') {
52e4c282
IZ
144 if (open my $fh, '<', 'perl5.def') {
145 while (<$fh>) {
146 last if /^\s*EXPORTS\b/;
147 }
148 while (<$fh>) {
78232bc0 149 $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
52e4c282
IZ
150 # This allows skipping ordinals which were used in older versions
151 $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
152 }
153 $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
154 }
2986a63f 155}
bbc8f9de 156
44c17813
NC
157my %skip;
158# All platforms export boot_DynaLoader unconditionally.
159my %export = ( boot_DynaLoader => 1 );
160
430d15ed
NC
161sub try_symbols {
162 foreach my $symbol (@_) {
44c17813
NC
163 ++$export{$symbol} unless exists $skip{$symbol};
164 }
165}
166
167sub readvar {
168 # $hash is the hash that we're adding to. For one of our callers, it will
169 # actually be the skip hash but that doesn't affect the intent of what
170 # we're doing, as in that case we skip adding something to the skip hash
171 # for the second time.
172
173 my ($file, $hash, $proc) = @_;
174 open my $vars, '<', $file or die die "Cannot open $file: $!\n";
175
176 while (<$vars>) {
177 # All symbols have a Perl_ prefix because that's what embed.h sticks
178 # in front of them. The A?I?S?C? is strictly speaking wrong.
179 next unless /\bPERLVAR(A?I?S?C?)\(([IGT])(\w+)/;
180
181 my $var = "PL_$3";
182 my $symbol = $proc ? &$proc($1,$2,$3) : $var;
183 ++$hash->{$symbol} unless exists $skip{$var};
51371543 184 }
22239a37
NIS
185}
186
f2921293 187if ($PLATFORM ne 'os2') {
e7c4906b 188 ++$skip{$_} foreach qw(
f2921293
NC
189 PL_cryptseen
190 PL_opsave
191 Perl_GetVars
192 Perl_dump_fds
193 Perl_my_bcopy
194 Perl_my_bzero
195 Perl_my_chsize
196 Perl_my_htonl
197 Perl_my_memcmp
198 Perl_my_memset
199 Perl_my_ntohl
200 Perl_my_swap
e7c4906b 201 );
c36317f0 202 if ($PLATFORM eq 'vms') {
e7c4906b 203 ++$skip{PL_statusvalue_posix};
c36317f0 204 } else {
e7c4906b 205 ++$skip{PL_statusvalue_vms};
c36317f0 206 if ($PLATFORM ne 'aix') {
e7c4906b 207 ++$skip{$_} foreach qw(
c36317f0
NC
208 PL_DBcv
209 PL_generation
210 PL_lastgotoprobe
211 PL_modcount
212 PL_timesbuf
213 main
e7c4906b 214 );
c36317f0
NC
215 }
216 }
f2921293
NC
217}
218
c36317f0
NC
219if ($PLATFORM ne 'vms') {
220 # VMS does its own thing for these symbols.
e7c4906b 221 ++$skip{$_} foreach qw(
c36317f0
NC
222 PL_sig_handlers_initted
223 PL_sig_ignoring
224 PL_sig_defaulting
e7c4906b 225 );
c36317f0 226 if ($PLATFORM ne 'win32') {
e7c4906b 227 ++$skip{$_} foreach qw(
c36317f0
NC
228 Perl_do_spawn
229 Perl_do_spawn_nowait
230 Perl_do_aspawn
e7c4906b 231 );
c36317f0 232 }
7766f137 233}
c36317f0 234
df39eaa8 235unless ($define{UNLINK_ALL_VERSIONS}) {
e7c4906b 236 ++$skip{Perl_unlnk};
93ea32b8 237}
3cfae81b 238
7766f137 239unless ($define{'DEBUGGING'}) {
e7c4906b 240 ++$skip{$_} foreach qw(
7766f137
GS
241 Perl_debop
242 Perl_debprofdump
243 Perl_debstack
244 Perl_debstackptrs
5cbf7fcf 245 Perl_pad_sv
b65222da 246 Perl_pad_setsv
943795c2 247 Perl_hv_assert
7766f137
GS
248 PL_block_type
249 PL_watchaddr
250 PL_watchok
e0cde265 251 PL_watch_pvx
e7c4906b 252 );
7766f137
GS
253}
254
255if ($define{'PERL_IMPLICIT_SYS'}) {
e7c4906b 256 ++$skip{$_} foreach qw(
7766f137
GS
257 Perl_my_popen
258 Perl_my_pclose
e7c4906b 259 );
2c84c919
NC
260 ++$export{$_} foreach qw(perl_get_host_info perl_alloc_override);
261 ++$export{perl_clone_host} if $define{USE_ITHREADS};
7766f137
GS
262}
263else {
e7c4906b 264 ++$skip{$_} foreach qw(
7766f137
GS
265 PL_Mem
266 PL_MemShared
267 PL_MemParse
268 PL_Env
269 PL_StdIO
270 PL_LIO
271 PL_Dir
272 PL_Sock
273 PL_Proc
2c84c919
NC
274 perl_alloc_using
275 perl_clone_using
e7c4906b 276 );
7766f137
GS
277}
278
f8c7b90f 279unless ($define{'PERL_OLD_COPY_ON_WRITE'}) {
e7c4906b 280 ++$skip{Perl_sv_setsv_cow};
0190f6ec
AT
281}
282
5bcb3f6c 283unless ($define{'USE_REENTRANT_API'}) {
e7c4906b 284 ++$skip{PL_reentrant_buffer};
5bcb3f6c
NIS
285}
286
7766f137 287if ($define{'MYMALLOC'}) {
430d15ed 288 try_symbols(qw(
7766f137 289 Perl_dump_mstats
827e134a 290 Perl_get_mstats
9c130f5b
NIS
291 Perl_strdup
292 Perl_putenv
6af660ee
IZ
293 MallocCfg_ptr
294 MallocCfgP_ptr
430d15ed 295 ));
3cf3941e
NC
296 unless ($define{USE_ITHREADS}) {
297 ++$skip{PL_malloc_mutex}
80fc1a6e 298 }
51371543
GS
299}
300else {
e7c4906b 301 ++$skip{$_} foreach qw(
7766f137
GS
302 PL_malloc_mutex
303 Perl_dump_mstats
6ecd3fcb 304 Perl_get_mstats
6af660ee
IZ
305 MallocCfg_ptr
306 MallocCfgP_ptr
e7c4906b 307 );
7766f137
GS
308}
309
8852afe9 310if ($define{'PERL_USE_SAFE_PUTENV'}) {
e7c4906b 311 ++$skip{PL_use_safe_putenv};
8852afe9
MB
312}
313
3db8f154 314unless ($define{'USE_ITHREADS'}) {
e7c4906b 315 ++$skip{PL_thr_key};
f433d095
GS
316}
317
3db8f154 318# USE_5005THREADS symbols. Kept as reference for easier removal
e7c4906b 319++$skip{$_} foreach qw(
7766f137
GS
320 PL_sv_mutex
321 PL_strtab_mutex
322 PL_svref_mutex
7766f137
GS
323 PL_cred_mutex
324 PL_eval_mutex
6940069f
GS
325 PL_fdpid_mutex
326 PL_sv_lock_mutex
7766f137
GS
327 PL_eval_cond
328 PL_eval_owner
329 PL_threads_mutex
330 PL_nthreads
331 PL_nthreads_cond
332 PL_threadnum
333 PL_threadsv_names
334 PL_thrsv
335 PL_vtbl_mutex
7766f137
GS
336 Perl_condpair_magic
337 Perl_new_struct_thread
338 Perl_per_thread_magicals
339 Perl_thread_create
340 Perl_find_threadsv
341 Perl_unlock_condpair
342 Perl_magic_mutexfree
4755096e 343 Perl_sv_lock
e7c4906b 344 );
7766f137
GS
345
346unless ($define{'USE_ITHREADS'}) {
e7c4906b 347 ++$skip{$_} foreach qw(
534825c4 348 PL_op_mutex
7e95b20d
JH
349 PL_regex_pad
350 PL_regex_padav
e2975953 351 PL_dollarzero_mutex
b60bf3b9 352 PL_hints_mutex
8703a9a4 353 PL_my_ctx_mutex
f1791e53 354 PL_perlio_mutex
7c425e3c
NC
355 Perl_clone_params_del
356 Perl_clone_params_new
b0bb49b6 357 Perl_parser_dup
7766f137
GS
358 Perl_dirp_dup
359 Perl_cx_dup
360 Perl_si_dup
361 Perl_any_dup
362 Perl_ss_dup
363 Perl_fp_dup
364 Perl_gp_dup
365 Perl_he_dup
366 Perl_mg_dup
7f605079 367 Perl_re_dup_guts
7766f137 368 Perl_sv_dup
7c425e3c 369 Perl_sv_dup_inc
aeef2723 370 Perl_rvpv_dup
88daff13 371 Perl_hek_dup
7766f137 372 Perl_sys_intern_dup
7766f137
GS
373 perl_clone
374 perl_clone_using
dc1061dc 375 Perl_stashpv_hvname_match
1fa600a7 376 Perl_regdupe_internal
392d04bb 377 Perl_newPADOP
e7c4906b 378 );
7766f137
GS
379}
380
381unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
e7c4906b 382 ++$skip{$_} foreach qw(
1f9ecdc6
SH
383 PL_my_cxt_index
384 PL_my_cxt_list
385 PL_my_cxt_size
ecb9cc66 386 PL_my_cxt_keys
7766f137
GS
387 Perl_croak_nocontext
388 Perl_die_nocontext
389 Perl_deb_nocontext
390 Perl_form_nocontext
e0f4245d 391 Perl_load_module_nocontext
7766f137
GS
392 Perl_mess_nocontext
393 Perl_warn_nocontext
394 Perl_warner_nocontext
395 Perl_newSVpvf_nocontext
396 Perl_sv_catpvf_nocontext
397 Perl_sv_setpvf_nocontext
398 Perl_sv_catpvf_mg_nocontext
399 Perl_sv_setpvf_mg_nocontext
484eff17 400 Perl_my_cxt_init
ecb9cc66 401 Perl_my_cxt_index
e7c4906b 402 );
7766f137
GS
403}
404
aadb217d 405unless ($define{'PL_OP_SLAB_ALLOC'}) {
e7c4906b 406 ++$skip{$_} foreach qw(
aadb217d
JH
407 PL_OpPtr
408 PL_OpSlab
409 PL_OpSpace
410 Perl_Slab_Alloc
411 Perl_Slab_Free
e7c4906b 412 );
8d2d9fd7
RGS
413}
414
415unless ($define{'PERL_DEBUG_READONLY_OPS'}) {
e7c4906b 416 ++$skip{$_} foreach qw(
8d2d9fd7
RGS
417 PL_slab_count
418 PL_slabs
e7c4906b 419 );
aadb217d
JH
420}
421
422unless ($define{'THREADS_HAVE_PIDS'}) {
e7c4906b 423 ++$skip{PL_ppid};
e0cde265
SH
424}
425
aadb217d 426unless ($define{'PERL_NEED_APPCTX'}) {
e7c4906b 427 ++$skip{PL_appctx};
e0cde265
SH
428}
429
aadb217d 430unless ($define{'PERL_NEED_TIMESBASE'}) {
e7c4906b 431 ++$skip{PL_timesbase};
e0cde265
SH
432}
433
dfc72f41 434unless ($define{'DEBUG_LEAKING_SCALARS'}) {
e7c4906b 435 ++$skip{PL_sv_serial};
dfc72f41
NC
436}
437
808e2276 438unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
e7c4906b 439 ++$skip{PL_dumper_fd};
808e2276 440}
e7c4906b 441
c69033f2 442unless ($define{'PERL_DONT_CREATE_GVSV'}) {
e7c4906b 443 ++$skip{Perl_gv_SVadd};
c69033f2 444}
e7c4906b 445
ce582cee 446if ($define{'SPRINTF_RETURNS_STRLEN'}) {
e7c4906b 447 ++$skip{Perl_my_sprintf};
ce582cee 448}
e7c4906b 449
ca0c25f6 450unless ($define{'PERL_USES_PL_PIDSTATUS'}) {
e7c4906b 451 ++$skip{PL_pidstatus};
ca0c25f6 452}
808e2276 453
02ca4724 454unless ($define{'PERL_TRACK_MEMPOOL'}) {
e7c4906b 455 ++$skip{PL_memory_debug_header};
02ca4724
SP
456}
457
2cea2a29 458unless ($define{PERL_MAD}) {
e7c4906b 459 ++$skip{$_} foreach qw(
e3e31fab
SH
460 PL_madskills
461 PL_xmlfp
e7c4906b 462 );
e3e31fab
SH
463}
464
2a5adacc 465unless ($define{'MULTIPLICITY'}) {
e7c4906b 466 ++$skip{$_} foreach qw(
01523419 467 PL_interp_size
9e08d3a4 468 PL_interp_size_5_16_0
e7c4906b 469 );
2a5adacc
JD
470}
471
472unless ($define{'PERL_GLOBAL_STRUCT'}) {
e7c4906b 473 ++$skip{PL_global_struct_size};
2a5adacc
JD
474}
475
436dbe32 476unless ($define{'PERL_GLOBAL_STRUCT_PRIVATE'}) {
e7c4906b 477 ++$skip{$_} foreach qw(
436dbe32
SH
478 PL_my_cxt_keys
479 Perl_my_cxt_index
e7c4906b 480 );
436dbe32
SH
481}
482
bd1ae5d2 483unless ($define{HAS_MMAP}) {
e7c4906b 484 ++$skip{PL_mmap_page_size};
ac6bedea
JH
485}
486
bd1ae5d2 487if ($define{HAS_SIGACTION}) {
e7c4906b 488 ++$skip{PL_sig_trapped};
d97afc04
AT
489}
490
bdcba273 491unless ($define{USE_LOCALE_COLLATE}) {
e7c4906b 492 ++$skip{$_} foreach qw(
bdcba273
NC
493 PL_collation_ix
494 PL_collation_name
495 PL_collation_standard
496 PL_collxfrm_base
497 PL_collxfrm_mult
498 Perl_sv_collxfrm
499 Perl_sv_collxfrm_flags
e7c4906b 500 );
bdcba273
NC
501}
502
1f1ade4f 503unless ($define{USE_LOCALE_NUMERIC}) {
e7c4906b 504 ++$skip{$_} foreach qw(
1f1ade4f
NC
505 PL_numeric_local
506 PL_numeric_name
507 PL_numeric_radix_sv
508 PL_numeric_standard
e7c4906b 509 );
1f1ade4f
NC
510}
511
1ab20eaa 512unless ($define{HAVE_INTERP_INTERN}) {
e7c4906b 513 ++$skip{$_} foreach qw(
1ab20eaa
NC
514 Perl_sys_intern_clear
515 Perl_sys_intern_dup
516 Perl_sys_intern_init
517 PL_sys_intern
e7c4906b 518 );
1ab20eaa
NC
519}
520
47e4ddfc 521if ($define{HAS_SIGNBIT}) {
e7c4906b 522 ++$skip{Perl_signbit};
47e4ddfc
NC
523}
524
7766f137 525if ($define{'PERL_GLOBAL_STRUCT'}) {
44c17813 526 readvar($perlvars_h, \%skip);
944921d3 527 ++$export{Perl_GetVars};
430d15ed 528 try_symbols(qw(PL_Vars PL_VarsPtr)) unless $CCTYPE eq 'GCC';
aadb217d 529} else {
e7c4906b 530 ++$skip{$_} foreach qw(Perl_init_global_struct Perl_free_global_struct);
7766f137 531}
36c15d3f 532
22c35a8c
GS
533# functions from *.sym files
534
7697f15a 535my @syms = ($global_sym, $globvar_sym);
549a6b10 536
d892637e
NIS
537# Symbols that are the public face of the PerlIO layers implementation
538# These are in _addition to_ the public face of the abstraction
539# and need to be exported to allow XS modules to implement layers
9df9a5cd 540my @layer_syms = qw(
db76e01e
JH
541 PerlIOBase_binmode
542 PerlIOBase_clearerr
543 PerlIOBase_close
544 PerlIOBase_dup
545 PerlIOBase_eof
546 PerlIOBase_error
547 PerlIOBase_fileno
548 PerlIOBase_noop_fail
549 PerlIOBase_noop_ok
550 PerlIOBase_popped
7e700b9a 551 PerlIOBase_pushed
db76e01e
JH
552 PerlIOBase_read
553 PerlIOBase_setlinebuf
554 PerlIOBase_unread
555 PerlIOBuf_bufsiz
556 PerlIOBuf_close
557 PerlIOBuf_dup
558 PerlIOBuf_fill
559 PerlIOBuf_flush
560 PerlIOBuf_get_base
561 PerlIOBuf_get_cnt
562 PerlIOBuf_get_ptr
563 PerlIOBuf_open
564 PerlIOBuf_popped
565 PerlIOBuf_pushed
566 PerlIOBuf_read
567 PerlIOBuf_seek
568 PerlIOBuf_set_ptrcnt
569 PerlIOBuf_tell
570 PerlIOBuf_unread
571 PerlIOBuf_write
572 PerlIO_allocate
8ffeedc3 573 PerlIO_apply_layera
db76e01e
JH
574 PerlIO_apply_layers
575 PerlIO_arg_fetch
576 PerlIO_debug
577 PerlIO_define_layer
4dcdb34a 578 PerlIO_find_layer
51d05609 579 PerlIO_isutf8
db76e01e 580 PerlIO_layer_fetch
4dcdb34a 581 PerlIO_list_alloc
db76e01e
JH
582 PerlIO_list_free
583 PerlIO_modestr
584 PerlIO_parse_layers
585 PerlIO_pending
586 PerlIO_perlio
587 PerlIO_pop
588 PerlIO_push
589 PerlIO_sv_dup
590 Perl_PerlIO_clearerr
591 Perl_PerlIO_close
188f0c84 592 Perl_PerlIO_context_layers
db76e01e
JH
593 Perl_PerlIO_eof
594 Perl_PerlIO_error
595 Perl_PerlIO_fileno
596 Perl_PerlIO_fill
597 Perl_PerlIO_flush
598 Perl_PerlIO_get_base
599 Perl_PerlIO_get_bufsiz
600 Perl_PerlIO_get_cnt
601 Perl_PerlIO_get_ptr
602 Perl_PerlIO_read
603 Perl_PerlIO_seek
604 Perl_PerlIO_set_cnt
605 Perl_PerlIO_set_ptrcnt
606 Perl_PerlIO_setlinebuf
607 Perl_PerlIO_stderr
608 Perl_PerlIO_stdin
609 Perl_PerlIO_stdout
610 Perl_PerlIO_tell
611 Perl_PerlIO_unread
612 Perl_PerlIO_write
9df9a5cd 613);
a5564b91
JH
614if ($PLATFORM eq 'netware') {
615 push(@layer_syms,'PL_def_layerlist','PL_known_layers','PL_perlio');
616}
d892637e 617
7766f137 618if ($define{'USE_PERLIO'}) {
d892637e
NIS
619 # Export the symols that make up the PerlIO abstraction, regardless
620 # of its implementation - read from a file
084592ab 621 push @syms, $perlio_sym;
d892637e
NIS
622
623 # This part is then dependent on how the abstraction is implemented
084592ab 624 if ($define{'USE_SFIO'}) {
d892637e 625 # Old legacy non-stdio "PerlIO"
e7c4906b
NC
626 ++$skip{$_} foreach @layer_syms;
627 ++$skip{perlsio_binmode};
084592ab 628 # SFIO defines most of the PerlIO routines as macros
d892637e
NIS
629 # So undo most of what $perlio_sym has just done - d'oh !
630 # Perhaps it would be better to list the ones which do exist
631 # And emit them
e7c4906b 632 ++$skip{$_} foreach qw(
084592ab
CN
633 PerlIO_canset_cnt
634 PerlIO_clearerr
635 PerlIO_close
636 PerlIO_eof
637 PerlIO_error
638 PerlIO_exportFILE
639 PerlIO_fast_gets
640 PerlIO_fdopen
641 PerlIO_fileno
642 PerlIO_findFILE
643 PerlIO_flush
644 PerlIO_get_base
645 PerlIO_get_bufsiz
646 PerlIO_get_cnt
647 PerlIO_get_ptr
648 PerlIO_getc
649 PerlIO_getname
650 PerlIO_has_base
651 PerlIO_has_cntptr
652 PerlIO_importFILE
653 PerlIO_open
654 PerlIO_printf
655 PerlIO_putc
656 PerlIO_puts
657 PerlIO_read
658 PerlIO_releaseFILE
659 PerlIO_reopen
660 PerlIO_rewind
661 PerlIO_seek
662 PerlIO_set_cnt
663 PerlIO_set_ptrcnt
664 PerlIO_setlinebuf
665 PerlIO_sprintf
666 PerlIO_stderr
667 PerlIO_stdin
668 PerlIO_stdout
669 PerlIO_stdoutf
670 PerlIO_tell
671 PerlIO_ungetc
672 PerlIO_vprintf
673 PerlIO_write
bcdb689b
JH
674 PerlIO_perlio
675 Perl_PerlIO_clearerr
676 Perl_PerlIO_close
677 Perl_PerlIO_eof
678 Perl_PerlIO_error
679 Perl_PerlIO_fileno
680 Perl_PerlIO_fill
681 Perl_PerlIO_flush
682 Perl_PerlIO_get_base
683 Perl_PerlIO_get_bufsiz
684 Perl_PerlIO_get_cnt
685 Perl_PerlIO_get_ptr
686 Perl_PerlIO_read
687 Perl_PerlIO_seek
688 Perl_PerlIO_set_cnt
689 Perl_PerlIO_set_ptrcnt
690 Perl_PerlIO_setlinebuf
691 Perl_PerlIO_stderr
692 Perl_PerlIO_stdin
693 Perl_PerlIO_stdout
694 Perl_PerlIO_tell
695 Perl_PerlIO_unread
696 Perl_PerlIO_write
ffcf5686
JH
697 PL_def_layerlist
698 PL_known_layers
699 PL_perlio
e7c4906b 700 );
084592ab 701 }
d892637e
NIS
702 else {
703 # PerlIO with layers - export implementation
430d15ed 704 try_symbols(@layer_syms, 'perlsio_binmode');
d892637e 705 }
5138f914 706} else {
d892637e
NIS
707 # -Uuseperlio
708 # Skip the PerlIO layer symbols - although
aadb217d 709 # nothing should have exported them anyway.
e7c4906b
NC
710 ++$skip{$_} foreach @layer_syms;
711 ++$skip{$_} foreach qw(
a6272963
SH
712 perlsio_binmode
713 PL_def_layerlist
714 PL_known_layers
715 PL_perlio
716 PL_perlio_debug_fd
717 PL_perlio_fd_refcnt
718 PL_perlio_fd_refcnt_size
01cace46 719 PL_perlio_mutex
e7c4906b 720 );
1e8a8f59 721
d892637e
NIS
722 # Also do NOT add abstraction symbols from $perlio_sym
723 # abstraction is done as #define to stdio
bf09e1bd 724 # Remaining remnants that _may_ be functions are handled below.
9df9a5cd 725}
7766f137 726
71afeaec
NC
727###############################################################################
728
729# At this point all skip lists should be completed, as we are about to test
730# many symbols against them.
731
7766f137
GS
732for my $syms (@syms) {
733 open (GLOBAL, "<$syms") || die "failed to open $syms: $!\n";
734 while (<GLOBAL>) {
735 next if (!/^[A-Za-z]/);
736 # Functions have a Perl_ prefix
737 # Variables have a PL_ prefix
738 chomp($_);
739 my $symbol = ($syms =~ /var\.sym$/i ? "PL_" : "");
740 $symbol .= $_;
944921d3 741 ++$export{$symbol} unless exists $skip{$symbol};
7766f137
GS
742 }
743 close(GLOBAL);
744}
0a753a76 745
22c35a8c 746# variables
0a753a76 747
87b9e160 748if ($define{'MULTIPLICITY'} && $define{PERL_GLOBAL_STRUCT}) {
44c17813 749 readvar($perlvars_h, \%export, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
1acb48c9 750 # XXX AIX seems to want the perlvars.h symbols, for some reason
5c728af0 751 if ($PLATFORM eq 'aix' or $PLATFORM eq 'os2') { # OS/2 needs PL_thr_key
44c17813 752 readvar($perlvars_h, \%export);
51371543
GS
753 }
754}
755else {
756 unless ($define{'PERL_GLOBAL_STRUCT'}) {
44c17813 757 readvar($perlvars_h, \%export);
9df9a5cd 758 }
87b9e160 759 unless ($define{MULTIPLICITY}) {
44c17813 760 readvar($intrpvar_h, \%export);
87b9e160 761 }
51371543 762}
0a753a76 763
bf09e1bd 764# Oddities from PerlIO
01cace46
NC
765# All have alternate implementations in perlio.c, so always exist.
766# Should they be considered to be part of the API?
430d15ed 767try_symbols(qw(
bf09e1bd
NC
768 PerlIO_binmode
769 PerlIO_getpos
770 PerlIO_init
771 PerlIO_setpos
772 PerlIO_sprintf
bf09e1bd
NC
773 PerlIO_tmpfile
774 PerlIO_vsprintf
430d15ed 775 ));
ac4c12e7 776
5581753c 777if ($PLATFORM eq 'win32') {
7a95c549 778 try_symbols(qw(
5581753c
NC
779 setgid
780 setuid
781 win32_free_childdir
782 win32_free_childenv
783 win32_get_childdir
784 win32_get_childenv
785 win32_spawnvp
7a95c549 786 ));
5581753c
NC
787}
788
18f68570 789if ($PLATFORM =~ /^win(?:32|ce)$/) {
7a95c549 790 try_symbols(qw(
7766f137 791 Perl_init_os_extras
c44d3fdb 792 Perl_thread_create
7766f137 793 Perl_win32_init
23f519f0 794 Perl_win32_term
7766f137 795 RunPerl
5290524f 796 win32_async_check
7766f137
GS
797 win32_errno
798 win32_environ
7766f137
GS
799 win32_abort
800 win32_fstat
801 win32_stat
802 win32_pipe
803 win32_popen
804 win32_pclose
805 win32_rename
806 win32_setmode
11bb82ff 807 win32_chsize
7766f137
GS
808 win32_lseek
809 win32_tell
810 win32_dup
811 win32_dup2
812 win32_open
813 win32_close
814 win32_eof
4342f4d6 815 win32_isatty
7766f137
GS
816 win32_read
817 win32_write
7766f137
GS
818 win32_mkdir
819 win32_rmdir
820 win32_chdir
821 win32_flock
822 win32_execv
823 win32_execvp
824 win32_htons
825 win32_ntohs
826 win32_htonl
827 win32_ntohl
828 win32_inet_addr
829 win32_inet_ntoa
830 win32_socket
831 win32_bind
832 win32_listen
833 win32_accept
834 win32_connect
835 win32_send
836 win32_sendto
837 win32_recv
838 win32_recvfrom
839 win32_shutdown
840 win32_closesocket
841 win32_ioctlsocket
842 win32_setsockopt
843 win32_getsockopt
844 win32_getpeername
845 win32_getsockname
846 win32_gethostname
847 win32_gethostbyname
848 win32_gethostbyaddr
849 win32_getprotobyname
850 win32_getprotobynumber
851 win32_getservbyname
852 win32_getservbyport
853 win32_select
854 win32_endhostent
855 win32_endnetent
856 win32_endprotoent
857 win32_endservent
858 win32_getnetent
859 win32_getnetbyname
860 win32_getnetbyaddr
861 win32_getprotoent
862 win32_getservent
863 win32_sethostent
864 win32_setnetent
865 win32_setprotoent
866 win32_setservent
867 win32_getenv
868 win32_putenv
869 win32_perror
7766f137
GS
870 win32_malloc
871 win32_calloc
872 win32_realloc
873 win32_free
874 win32_sleep
875 win32_times
876 win32_access
877 win32_alarm
878 win32_chmod
879 win32_open_osfhandle
880 win32_get_osfhandle
881 win32_ioctl
882 win32_link
883 win32_unlink
884 win32_utime
57ab3dfe 885 win32_gettimeofday
7766f137
GS
886 win32_uname
887 win32_wait
888 win32_waitpid
889 win32_kill
890 win32_str_os_error
891 win32_opendir
892 win32_readdir
893 win32_telldir
894 win32_seekdir
895 win32_rewinddir
896 win32_closedir
897 win32_longpath
aa2b96ec 898 win32_ansipath
7766f137
GS
899 win32_os_id
900 win32_getpid
901 win32_crypt
902 win32_dynaload
df3728a2 903 win32_clearenv
00b02797
JH
904 win32_stdin
905 win32_stdout
906 win32_stderr
907 win32_ferror
908 win32_feof
909 win32_strerror
910 win32_fprintf
911 win32_printf
912 win32_vfprintf
913 win32_vprintf
914 win32_fread
915 win32_fwrite
916 win32_fopen
917 win32_fdopen
918 win32_freopen
919 win32_fclose
920 win32_fputs
921 win32_fputc
922 win32_ungetc
923 win32_getc
924 win32_fileno
925 win32_clearerr
926 win32_fflush
927 win32_ftell
928 win32_fseek
929 win32_fgetpos
930 win32_fsetpos
931 win32_rewind
932 win32_tmpfile
933 win32_setbuf
934 win32_setvbuf
935 win32_flushall
936 win32_fcloseall
937 win32_fgets
938 win32_gets
939 win32_fgetc
940 win32_putc
941 win32_puts
942 win32_getchar
943 win32_putchar
7a95c549 944 ));
3a00b83e 945 if ($CCTYPE eq "BORLAND") {
7a95c549 946 try_symbols('_matherr');
3a00b83e 947 }
549a6b10 948}
71afeaec
NC
949elsif ($PLATFORM eq 'vms') {
950 try_symbols(qw(
951 Perl_cando
952 Perl_cando_by_name
953 Perl_closedir
954 Perl_csighandler_init
955 Perl_do_rmdir
956 Perl_fileify_dirspec
957 Perl_fileify_dirspec_ts
958 Perl_fileify_dirspec_utf8
959 Perl_fileify_dirspec_utf8_ts
960 Perl_flex_fstat
961 Perl_flex_lstat
962 Perl_flex_stat
963 Perl_kill_file
964 Perl_my_chdir
965 Perl_my_chmod
966 Perl_my_crypt
967 Perl_my_endpwent
968 Perl_my_fclose
969 Perl_my_fdopen
970 Perl_my_fgetname
971 Perl_my_flush
972 Perl_my_fwrite
973 Perl_my_gconvert
974 Perl_my_getenv
975 Perl_my_getenv_len
976 Perl_my_getlogin
977 Perl_my_getpwnam
978 Perl_my_getpwuid
979 Perl_my_gmtime
980 Perl_my_kill
981 Perl_my_localtime
982 Perl_my_mkdir
983 Perl_my_sigaction
984 Perl_my_symlink
985 Perl_my_time
986 Perl_my_tmpfile
987 Perl_my_trnlnm
988 Perl_my_utime
989 Perl_my_waitpid
990 Perl_opendir
991 Perl_pathify_dirspec
992 Perl_pathify_dirspec_ts
993 Perl_pathify_dirspec_utf8
994 Perl_pathify_dirspec_utf8_ts
995 Perl_readdir
996 Perl_readdir_r
997 Perl_rename
998 Perl_rmscopy
999 Perl_rmsexpand
1000 Perl_rmsexpand_ts
1001 Perl_rmsexpand_utf8
1002 Perl_rmsexpand_utf8_ts
1003 Perl_seekdir
1004 Perl_sig_to_vmscondition
1005 Perl_telldir
1006 Perl_tounixpath
1007 Perl_tounixpath_ts
1008 Perl_tounixpath_utf8
1009 Perl_tounixpath_utf8_ts
1010 Perl_tounixspec
1011 Perl_tounixspec_ts
1012 Perl_tounixspec_utf8
1013 Perl_tounixspec_utf8_ts
1014 Perl_tovmspath
1015 Perl_tovmspath_ts
1016 Perl_tovmspath_utf8
1017 Perl_tovmspath_utf8_ts
1018 Perl_tovmsspec
1019 Perl_tovmsspec_ts
1020 Perl_tovmsspec_utf8
1021 Perl_tovmsspec_utf8_ts
1022 Perl_trim_unixpath
1023 Perl_vms_case_tolerant
1024 Perl_vms_do_aexec
1025 Perl_vms_do_exec
1026 Perl_vms_image_init
1027 Perl_vms_realpath
1028 Perl_vmssetenv
1029 Perl_vmssetuserlnm
1030 Perl_vmstrnenv
1031 PerlIO_openn
1032 ));
1033}
3cfae81b 1034elsif ($PLATFORM eq 'os2') {
71afeaec
NC
1035 try_symbols(qw(
1036 ctermid
1037 get_sysinfo
1038 Perl_OS2_init
1039 Perl_OS2_init3
1040 Perl_OS2_term
1041 OS2_Perl_data
1042 dlopen
1043 dlsym
1044 dlerror
1045 dlclose
1046 dup2
1047 dup
1048 my_tmpfile
1049 my_tmpnam
1050 my_flock
1051 my_rmdir
1052 my_mkdir
1053 my_getpwuid
1054 my_getpwnam
1055 my_getpwent
1056 my_setpwent
1057 my_endpwent
1058 fork_with_resources
1059 croak_with_os2error
1060 setgrent
1061 endgrent
1062 getgrent
1063 malloc_mutex
1064 threads_mutex
1065 nthreads
1066 nthreads_cond
1067 os2_cond_wait
1068 os2_stat
1069 os2_execname
1070 async_mssleep
1071 msCounter
1072 InfoTable
1073 pthread_join
1074 pthread_create
1075 pthread_detach
1076 XS_Cwd_change_drive
1077 XS_Cwd_current_drive
1078 XS_Cwd_extLibpath
1079 XS_Cwd_extLibpath_set
1080 XS_Cwd_sys_abspath
1081 XS_Cwd_sys_chdir
1082 XS_Cwd_sys_cwd
1083 XS_Cwd_sys_is_absolute
1084 XS_Cwd_sys_is_relative
1085 XS_Cwd_sys_is_rooted
1086 XS_DynaLoader_mod2fname
1087 XS_File__Copy_syscopy
1088 Perl_Register_MQ
1089 Perl_Deregister_MQ
1090 Perl_Serve_Messages
1091 Perl_Process_Messages
1092 init_PMWIN_entries
1093 PMWIN_entries
1094 Perl_hab_GET
1095 loadByOrdinal
1096 pExtFCN
1097 os2error
1098 ResetWinError
1099 CroakWinError
1100 PL_do_undump
1101 ));
3cfae81b 1102}
2986a63f 1103elsif ($PLATFORM eq 'netware') {
7a95c549 1104 try_symbols(qw(
2986a63f
JH
1105 Perl_init_os_extras
1106 Perl_thread_create
1107 Perl_nw5_init
1108 RunPerl
1109 AllocStdPerl
1110 FreeStdPerl
1111 do_spawn2
1112 do_aspawn
1113 nw_uname
1114 nw_stdin
1115 nw_stdout
1116 nw_stderr
1117 nw_feof
1118 nw_ferror
1119 nw_fopen
1120 nw_fclose
1121 nw_clearerr
1122 nw_getc
1123 nw_fgets
1124 nw_fputc
1125 nw_fputs
1126 nw_fflush
1127 nw_ungetc
1128 nw_fileno
1129 nw_fdopen
1130 nw_freopen
1131 nw_fread
1132 nw_fwrite
1133 nw_setbuf
1134 nw_setvbuf
1135 nw_vfprintf
1136 nw_ftell
1137 nw_fseek
1138 nw_rewind
1139 nw_tmpfile
1140 nw_fgetpos
1141 nw_fsetpos
1142 nw_dup
1143 nw_access
1144 nw_chmod
1145 nw_chsize
1146 nw_close
1147 nw_dup2
1148 nw_flock
1149 nw_isatty
1150 nw_link
1151 nw_lseek
1152 nw_stat
1153 nw_mktemp
1154 nw_open
1155 nw_read
1156 nw_rename
1157 nw_setmode
1158 nw_unlink
1159 nw_utime
1160 nw_write
1161 nw_chdir
1162 nw_rmdir
1163 nw_closedir
1164 nw_opendir
1165 nw_readdir
1166 nw_rewinddir
1167 nw_seekdir
1168 nw_telldir
1169 nw_htonl
1170 nw_htons
1171 nw_ntohl
1172 nw_ntohs
1173 nw_accept
1174 nw_bind
1175 nw_connect
1176 nw_endhostent
1177 nw_endnetent
1178 nw_endprotoent
1179 nw_endservent
1180 nw_gethostbyaddr
1181 nw_gethostbyname
1182 nw_gethostent
1183 nw_gethostname
1184 nw_getnetbyaddr
1185 nw_getnetbyname
1186 nw_getnetent
1187 nw_getpeername
1188 nw_getprotobyname
1189 nw_getprotobynumber
1190 nw_getprotoent
1191 nw_getservbyname
1192 nw_getservbyport
1193 nw_getservent
1194 nw_getsockname
1195 nw_getsockopt
1196 nw_inet_addr
1197 nw_listen
1198 nw_socket
1199 nw_recv
1200 nw_recvfrom
1201 nw_select
1202 nw_send
1203 nw_sendto
1204 nw_sethostent
1205 nw_setnetent
1206 nw_setprotoent
1207 nw_setservent
3a0827a6 1208 nw_setsockopt
4d76e4b4 1209 nw_inet_ntoa
2986a63f
JH
1210 nw_shutdown
1211 nw_crypt
1212 nw_execvp
1213 nw_kill
1214 nw_Popen
1215 nw_Pclose
1216 nw_Pipe
1217 nw_times
1218 nw_waitpid
1219 nw_getpid
1220 nw_spawnvp
1221 nw_os_id
1222 nw_open_osfhandle
1223 nw_get_osfhandle
1224 nw_abort
1225 nw_sleep
1226 nw_wait
1227 nw_dynaload
1228 nw_strerror
1229 fnFpSetMode
1230 fnInsertHashListAddrs
1231 fnGetHashListAddrs
1232 Perl_deb
011f1a1a
JH
1233 Perl_sv_setsv
1234 Perl_sv_catsv
1235 Perl_sv_catpvn
1236 Perl_sv_2pv
f355267c
JH
1237 nw_freeenviron
1238 Remove_Thread_Ctx
7a95c549 1239 ));
2986a63f 1240}
22239a37 1241
9661ac31
NC
1242# When added this code was only run for Win32 and WinCE
1243# Currently only Win32 links static extensions into the shared library.
1244# The WinCE makefile doesn't appear to support static extensions, so this code
1245# can't have any effect there.
1246# The NetWare Makefile doesn't support static extensions (and hardcodes the
1247# list of dynamic extensions, and the rules to build them)
1248# For *nix (and presumably OS/2) with a shared libperl, Makefile.SH compiles
1249# static extensions with -fPIC, but links them to perl, not libperl.so
1250# The VMS build scripts don't yet implement static extensions at all.
1251
1252if ($PLATFORM =~ /^win(?:32|ce)$/) {
1253 # records of type boot_module for statically linked modules (except Dynaloader)
c051ff4c 1254 my $static_ext = $Config{static_ext} // "";
9661ac31
NC
1255 $static_ext =~ s/\//__/g;
1256 $static_ext =~ s/\bDynaLoader\b//;
1257 try_symbols(map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext);
1258 try_symbols("init_Win32CORE") if $static_ext =~ /\bWin32CORE\b/;
1259}
9fb265f7 1260
71afeaec
NC
1261if ($PLATFORM eq 'os2') {
1262 my (%mapped, @missing);
1263 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1264 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1265 close MAP or die 'Cannot close miniperl.map';
1266
1267 @missing = grep { !exists $mapped{$_} }
1268 keys %export;
1269 @missing = grep { !exists $exportperlmalloc{$_} } @missing;
1270 delete $export{$_} foreach @missing;
1271}
1272
d6035849
NC
1273###############################################################################
1274
1275# Now all symbols should be defined because next we are going to output them.
1276
1277# Start with platform specific headers:
1278
1279if ($PLATFORM =~ /^win(?:32|ce)$/) {
1280 (my $dll = ($define{PERL_DLL} || "perl515")) =~ s/\.dll$//i;
1281 print "LIBRARY $dll\n";
1282 # The DESCRIPTION module definition file statement is not supported
1283 # by VC7 onwards.
1284 if ($CCTYPE =~ /^(?:MSVC60|GCC|BORLAND)$/) {
1285 print "DESCRIPTION 'Perl interpreter'\n";
1286 }
1287 print "EXPORTS\n";
1288}
1289elsif ($PLATFORM eq 'os2') {
1290 (my $v = $]) =~ s/(\d\.\d\d\d)(\d\d)$/$1_$2/;
c051ff4c 1291 $v .= '-thread' if $Config{archname} =~ /-thread/;
d6035849 1292 (my $dll = $define{PERL_DLL}) =~ s/\.dll$//i;
c051ff4c
NC
1293 $v .= "\@$Config{perl_patchlevel}" if $Config{perl_patchlevel};
1294 my $d = "DESCRIPTION '\@#perl5-porters\@perl.org:$v#\@ Perl interpreter, configured as $Config{config_args}'";
d6035849
NC
1295 $d = substr($d, 0, 249) . "...'" if length $d > 253;
1296 print <<"---EOP---";
1297LIBRARY '$dll' INITINSTANCE TERMINSTANCE
1298$d
1299STACKSIZE 32768
1300CODE LOADONCALL
1301DATA LOADONCALL NONSHARED MULTIPLE
1302EXPORTS
1303---EOP---
1304}
1305elsif ($PLATFORM eq 'aix') {
1306 my $OSVER = `uname -v`;
1307 chop $OSVER;
1308 my $OSREL = `uname -r`;
1309 chop $OSREL;
1310 if ($OSVER > 4 || ($OSVER == 4 && $OSREL >= 3)) {
1311 print "#! ..\n";
1312 } else {
1313 print "#!\n";
1314 }
1315}
1316elsif ($PLATFORM eq 'netware') {
1317 if ($FILETYPE eq 'def') {
1318 print "LIBRARY perl515\n";
1319 print "DESCRIPTION 'Perl interpreter for NetWare'\n";
1320 print "EXPORTS\n";
1321 }
1322}
1323
1324# Then the symbols
549a6b10 1325
7766f137 1326foreach my $symbol (sort keys %export) {
18f68570 1327 if ($PLATFORM =~ /^win(?:32|ce)$/) {
549a6b10 1328 $symbol = "_$symbol" if $CCTYPE eq 'BORLAND';
520c758a 1329 print "\t$symbol\n";
7766f137
GS
1330 }
1331 elsif ($PLATFORM eq 'os2') {
52e4c282
IZ
1332 printf qq( %-31s \@%s\n),
1333 qq("$symbol"), $ordinal{$symbol} || ++$sym_ord;
78232bc0
JH
1334 printf qq( %-31s \@%s\n),
1335 qq("$exportperlmalloc{$symbol}" = "$symbol"),
1336 $ordinal{$exportperlmalloc{$symbol}} || ++$sym_ord
1337 if $exportperlmalloc and exists $exportperlmalloc{$symbol};
7766f137 1338 }
ed463ba8
NC
1339 elsif ($PLATFORM eq 'netware') {
1340 print "\t$symbol,\n";
1341 } else {
549a6b10
JH
1342 print "$symbol\n";
1343 }
ed463ba8
NC
1344}
1345
1346# Then platform specific footers.
1347
1348if ($PLATFORM eq 'os2') {
1349 print <<EOP;
1350 dll_perlmain=main
1351 fill_extLibpath
1352 dir_subst
1353 Perl_OS2_handler_install
1354
1355; LAST_ORDINAL=$sym_ord
1356EOP
549a6b10
JH
1357}
1358
13591;