This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add regen/embed_lib.pl, for the code that processes embed.fnc and regen/opcodes
[perl5.git] / makedef.pl
CommitLineData
3df97b6d 1#./perl -w
549a6b10
JH
2#
3# Create the export list for perl.
4#
86593e8d 5# Needed by WIN32 and OS/2 for creating perl.dll,
60fae896 6# and by AIX for creating libperl.a when -Duseshrplib 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
b78dc5b5 38my %ARGS = (CCTYPE => 'MSVC', TARG_DIR => '');
3df97b6d 39
d6035849 40my %define;
910dfcc8 41
c1b34f5f
NC
42sub process_cc_flags {
43 foreach (map {split /\s+/, $_} @_) {
44 $define{$1} = $2 // 1 if /^-D(\w+)(?:=(.+))?/;
45 }
46}
47
7766f137
GS
48while (@ARGV) {
49 my $flag = shift;
c1b34f5f
NC
50 if ($flag =~ /^(?:CC_FLAGS=)?(-D\w.*)/) {
51 process_cc_flags($1);
0dc3711c
NC
52 } elsif ($flag =~ /^(CCTYPE|FILETYPE|PLATFORM|TARG_DIR)=(.+)$/) {
53 $ARGS{$1} = $2;
5c728af0 54 }
7766f137 55}
d55594ae 56
29200a82 57{
1f7ae1be 58 my @PLATFORM = qw(aix win32 wince os2 netware vms test);
29200a82
NC
59 my %PLATFORM;
60 @PLATFORM{@PLATFORM} = ();
549a6b10 61
29200a82
NC
62 die "PLATFORM undefined, must be one of: @PLATFORM\n"
63 unless defined $ARGS{PLATFORM};
64 die "PLATFORM must be one of: @PLATFORM\n"
65 unless exists $PLATFORM{$ARGS{PLATFORM}};
66}
549a6b10 67
208d7614
NC
68# Is the following guard strictly necessary? Added during refactoring
69# to keep the same behaviour when merging other code into here.
c1b34f5f 70process_cc_flags(@Config{qw(ccflags optimize)})
0dc3711c
NC
71 if $ARGS{PLATFORM} ne 'win32' && $ARGS{PLATFORM} ne 'wince'
72 && $ARGS{PLATFORM} ne 'netware';
208d7614 73
c960bcfd
NC
74# Add the compile-time options that miniperl was built with to %define.
75# On Win32 these are not the same options as perl itself will be built
76# with since miniperl is built with a canned config (one of the win32/
77# config_H.*) and none of the BUILDOPT's that are set in the makefiles,
78# but they do include some #define's that are hard-coded in various
79# source files and header files and don't include any BUILDOPT's that
80# the user might have chosen to disable because the canned configs are
81# minimal configs that don't include any of those options.
82
83my @options = sort(Config::bincompat_options(), Config::non_bincompat_options());
1f7ae1be 84print STDERR "Options: (@options)\n" unless $ARGS{PLATFORM} eq 'test';
c960bcfd 85$define{$_} = 1 foreach @options;
17bdc114 86
c6261f3b
JH
87my %exportperlmalloc =
88 (
89 Perl_malloc => "malloc",
90 Perl_mfree => "free",
91 Perl_realloc => "realloc",
92 Perl_calloc => "calloc",
93 );
94
0dc3711c 95my $exportperlmalloc = $ARGS{PLATFORM} eq 'os2';
c6261f3b 96
762c82db 97open(CFG, '<', 'config.h') || die "Cannot open config.h: $!\n";
7766f137 98while (<CFG>) {
1f0041ed 99 $define{$1} = 1 if /^\s*\#\s*define\s+(MYMALLOC|MULTIPLICITY
918a61c7 100 |SPRINTF_RETURNS_STRLEN
1f0041ed 101 |(?:PERL|USE|HAS)_\w+)\b/x;
7766f137 102}
bbc8f9de
NIS
103close(CFG);
104
18c4b137
JH
105# perl.h logic duplication begins
106
894ccb8c
JH
107if ($define{PERL_IMPLICIT_SYS}) {
108 $define{PL_OP_SLAB_ALLOC} = 1;
109}
ac6bedea 110
18c4b137 111if ($define{USE_ITHREADS}) {
acfe0abc 112 if (!$define{MULTIPLICITY}) {
18c4b137
JH
113 $define{MULTIPLICITY} = 1;
114 }
115}
116
117$define{PERL_IMPLICIT_CONTEXT} ||=
118 $define{USE_ITHREADS} ||
18c4b137
JH
119 $define{MULTIPLICITY} ;
120
0dc3711c 121if ($define{USE_ITHREADS} && $ARGS{PLATFORM} ne 'win32' && $^O ne 'darwin') {
10bc17b6
JH
122 $define{USE_REENTRANT_API} = 1;
123}
124
18c4b137
JH
125# perl.h logic duplication ends
126
1f7ae1be
NC
127print STDERR "Defines: (" . join(' ', sort keys %define) . ")\n"
128 unless $ARGS{PLATFORM} eq 'test';
dcddf0a3 129
d6035849
NC
130my $sym_ord = 0;
131my %ordinal;
132
0dc3711c 133if ($ARGS{PLATFORM} eq 'os2') {
52e4c282
IZ
134 if (open my $fh, '<', 'perl5.def') {
135 while (<$fh>) {
136 last if /^\s*EXPORTS\b/;
137 }
138 while (<$fh>) {
78232bc0 139 $ordinal{$1} = $2 if /^\s*"(\w+)"\s*(?:=\s*"\w+"\s*)?\@(\d+)\s*$/;
52e4c282
IZ
140 # This allows skipping ordinals which were used in older versions
141 $sym_ord = $1 if /^\s*;\s*LAST_ORDINAL\s*=\s*(\d+)\s*$/;
142 }
143 $sym_ord < $_ and $sym_ord = $_ for values %ordinal; # Take the max
144 }
2986a63f 145}
bbc8f9de 146
44c17813
NC
147my %skip;
148# All platforms export boot_DynaLoader unconditionally.
149my %export = ( boot_DynaLoader => 1 );
150
430d15ed
NC
151sub try_symbols {
152 foreach my $symbol (@_) {
44c17813
NC
153 ++$export{$symbol} unless exists $skip{$symbol};
154 }
155}
156
157sub readvar {
158 # $hash is the hash that we're adding to. For one of our callers, it will
159 # actually be the skip hash but that doesn't affect the intent of what
160 # we're doing, as in that case we skip adding something to the skip hash
161 # for the second time.
162
321600e1
NC
163 my $file = $ARGS{TARG_DIR} . shift;
164 my $hash = shift;
165 my $proc = shift;
44c17813
NC
166 open my $vars, '<', $file or die die "Cannot open $file: $!\n";
167
168 while (<$vars>) {
169 # All symbols have a Perl_ prefix because that's what embed.h sticks
170 # in front of them. The A?I?S?C? is strictly speaking wrong.
115ff745 171 next unless /\bPERLVAR(A?I?S?C?)\(([IGT]),\s*(\w+)/;
44c17813
NC
172
173 my $var = "PL_$3";
174 my $symbol = $proc ? &$proc($1,$2,$3) : $var;
175 ++$hash->{$symbol} unless exists $skip{$var};
51371543 176 }
22239a37
NIS
177}
178
0dc3711c 179if ($ARGS{PLATFORM} ne 'os2') {
e7c4906b 180 ++$skip{$_} foreach qw(
f2921293
NC
181 PL_cryptseen
182 PL_opsave
183 Perl_GetVars
184 Perl_dump_fds
185 Perl_my_bcopy
186 Perl_my_bzero
187 Perl_my_chsize
188 Perl_my_htonl
189 Perl_my_memcmp
190 Perl_my_memset
191 Perl_my_ntohl
192 Perl_my_swap
e7c4906b 193 );
0dc3711c 194 if ($ARGS{PLATFORM} eq 'vms') {
e7c4906b 195 ++$skip{PL_statusvalue_posix};
c36317f0 196 } else {
e7c4906b 197 ++$skip{PL_statusvalue_vms};
0dc3711c 198 if ($ARGS{PLATFORM} ne 'aix') {
e7c4906b 199 ++$skip{$_} foreach qw(
c36317f0
NC
200 PL_DBcv
201 PL_generation
202 PL_lastgotoprobe
203 PL_modcount
204 PL_timesbuf
205 main
e7c4906b 206 );
c36317f0
NC
207 }
208 }
f2921293
NC
209}
210
0dc3711c 211if ($ARGS{PLATFORM} ne 'vms') {
c36317f0 212 # VMS does its own thing for these symbols.
e7c4906b 213 ++$skip{$_} foreach qw(
c36317f0
NC
214 PL_sig_handlers_initted
215 PL_sig_ignoring
216 PL_sig_defaulting
e7c4906b 217 );
0dc3711c 218 if ($ARGS{PLATFORM} ne 'win32') {
e7c4906b 219 ++$skip{$_} foreach qw(
c36317f0
NC
220 Perl_do_spawn
221 Perl_do_spawn_nowait
222 Perl_do_aspawn
e7c4906b 223 );
c36317f0 224 }
7766f137 225}
c36317f0 226
df39eaa8 227unless ($define{UNLINK_ALL_VERSIONS}) {
e7c4906b 228 ++$skip{Perl_unlnk};
93ea32b8 229}
3cfae81b 230
7766f137 231unless ($define{'DEBUGGING'}) {
e7c4906b 232 ++$skip{$_} foreach qw(
7766f137
GS
233 Perl_debop
234 Perl_debprofdump
235 Perl_debstack
236 Perl_debstackptrs
5cbf7fcf 237 Perl_pad_sv
b65222da 238 Perl_pad_setsv
943795c2 239 Perl_hv_assert
7766f137
GS
240 PL_block_type
241 PL_watchaddr
242 PL_watchok
e0cde265 243 PL_watch_pvx
e7c4906b 244 );
7766f137
GS
245}
246
247if ($define{'PERL_IMPLICIT_SYS'}) {
e7c4906b 248 ++$skip{$_} foreach qw(
7766f137
GS
249 Perl_my_popen
250 Perl_my_pclose
e7c4906b 251 );
2c84c919
NC
252 ++$export{$_} foreach qw(perl_get_host_info perl_alloc_override);
253 ++$export{perl_clone_host} if $define{USE_ITHREADS};
7766f137
GS
254}
255else {
e7c4906b 256 ++$skip{$_} foreach qw(
7766f137
GS
257 PL_Mem
258 PL_MemShared
259 PL_MemParse
260 PL_Env
261 PL_StdIO
262 PL_LIO
263 PL_Dir
264 PL_Sock
265 PL_Proc
2c84c919
NC
266 perl_alloc_using
267 perl_clone_using
e7c4906b 268 );
7766f137
GS
269}
270
f8c7b90f 271unless ($define{'PERL_OLD_COPY_ON_WRITE'}) {
e7c4906b 272 ++$skip{Perl_sv_setsv_cow};
0190f6ec
AT
273}
274
5bcb3f6c 275unless ($define{'USE_REENTRANT_API'}) {
e7c4906b 276 ++$skip{PL_reentrant_buffer};
5bcb3f6c
NIS
277}
278
7766f137 279if ($define{'MYMALLOC'}) {
430d15ed 280 try_symbols(qw(
7766f137 281 Perl_dump_mstats
827e134a 282 Perl_get_mstats
9c130f5b
NIS
283 Perl_strdup
284 Perl_putenv
6af660ee
IZ
285 MallocCfg_ptr
286 MallocCfgP_ptr
430d15ed 287 ));
3cf3941e
NC
288 unless ($define{USE_ITHREADS}) {
289 ++$skip{PL_malloc_mutex}
80fc1a6e 290 }
51371543
GS
291}
292else {
e7c4906b 293 ++$skip{$_} foreach qw(
7766f137
GS
294 PL_malloc_mutex
295 Perl_dump_mstats
6ecd3fcb 296 Perl_get_mstats
6af660ee
IZ
297 MallocCfg_ptr
298 MallocCfgP_ptr
e7c4906b 299 );
7766f137
GS
300}
301
8852afe9 302if ($define{'PERL_USE_SAFE_PUTENV'}) {
e7c4906b 303 ++$skip{PL_use_safe_putenv};
8852afe9
MB
304}
305
3db8f154 306unless ($define{'USE_ITHREADS'}) {
e7c4906b 307 ++$skip{PL_thr_key};
f433d095
GS
308}
309
3db8f154 310# USE_5005THREADS symbols. Kept as reference for easier removal
e7c4906b 311++$skip{$_} foreach qw(
7766f137
GS
312 PL_sv_mutex
313 PL_strtab_mutex
314 PL_svref_mutex
7766f137
GS
315 PL_cred_mutex
316 PL_eval_mutex
6940069f
GS
317 PL_fdpid_mutex
318 PL_sv_lock_mutex
7766f137
GS
319 PL_eval_cond
320 PL_eval_owner
321 PL_threads_mutex
322 PL_nthreads
323 PL_nthreads_cond
324 PL_threadnum
325 PL_threadsv_names
326 PL_thrsv
327 PL_vtbl_mutex
7766f137
GS
328 Perl_condpair_magic
329 Perl_new_struct_thread
330 Perl_per_thread_magicals
331 Perl_thread_create
332 Perl_find_threadsv
333 Perl_unlock_condpair
334 Perl_magic_mutexfree
4755096e 335 Perl_sv_lock
e7c4906b 336 );
7766f137
GS
337
338unless ($define{'USE_ITHREADS'}) {
e7c4906b 339 ++$skip{$_} foreach qw(
534825c4 340 PL_op_mutex
7e95b20d
JH
341 PL_regex_pad
342 PL_regex_padav
e2975953 343 PL_dollarzero_mutex
b60bf3b9 344 PL_hints_mutex
8703a9a4 345 PL_my_ctx_mutex
f1791e53 346 PL_perlio_mutex
7c425e3c
NC
347 Perl_clone_params_del
348 Perl_clone_params_new
b0bb49b6 349 Perl_parser_dup
7766f137
GS
350 Perl_dirp_dup
351 Perl_cx_dup
352 Perl_si_dup
353 Perl_any_dup
354 Perl_ss_dup
355 Perl_fp_dup
356 Perl_gp_dup
357 Perl_he_dup
358 Perl_mg_dup
7f605079 359 Perl_re_dup_guts
7766f137 360 Perl_sv_dup
7c425e3c 361 Perl_sv_dup_inc
aeef2723 362 Perl_rvpv_dup
88daff13 363 Perl_hek_dup
7766f137 364 Perl_sys_intern_dup
7766f137
GS
365 perl_clone
366 perl_clone_using
dc1061dc 367 Perl_stashpv_hvname_match
1fa600a7 368 Perl_regdupe_internal
392d04bb 369 Perl_newPADOP
e7c4906b 370 );
7766f137
GS
371}
372
373unless ($define{'PERL_IMPLICIT_CONTEXT'}) {
e7c4906b 374 ++$skip{$_} foreach qw(
1f9ecdc6
SH
375 PL_my_cxt_index
376 PL_my_cxt_list
377 PL_my_cxt_size
ecb9cc66 378 PL_my_cxt_keys
7766f137
GS
379 Perl_croak_nocontext
380 Perl_die_nocontext
381 Perl_deb_nocontext
382 Perl_form_nocontext
e0f4245d 383 Perl_load_module_nocontext
7766f137
GS
384 Perl_mess_nocontext
385 Perl_warn_nocontext
386 Perl_warner_nocontext
387 Perl_newSVpvf_nocontext
388 Perl_sv_catpvf_nocontext
389 Perl_sv_setpvf_nocontext
390 Perl_sv_catpvf_mg_nocontext
391 Perl_sv_setpvf_mg_nocontext
484eff17 392 Perl_my_cxt_init
ecb9cc66 393 Perl_my_cxt_index
e7c4906b 394 );
7766f137
GS
395}
396
aadb217d 397unless ($define{'PL_OP_SLAB_ALLOC'}) {
e7c4906b 398 ++$skip{$_} foreach qw(
aadb217d
JH
399 PL_OpPtr
400 PL_OpSlab
401 PL_OpSpace
402 Perl_Slab_Alloc
403 Perl_Slab_Free
e7c4906b 404 );
8d2d9fd7
RGS
405}
406
407unless ($define{'PERL_DEBUG_READONLY_OPS'}) {
e7c4906b 408 ++$skip{$_} foreach qw(
8d2d9fd7
RGS
409 PL_slab_count
410 PL_slabs
e7c4906b 411 );
aadb217d
JH
412}
413
414unless ($define{'THREADS_HAVE_PIDS'}) {
e7c4906b 415 ++$skip{PL_ppid};
e0cde265
SH
416}
417
aadb217d 418unless ($define{'PERL_NEED_APPCTX'}) {
e7c4906b 419 ++$skip{PL_appctx};
e0cde265
SH
420}
421
aadb217d 422unless ($define{'PERL_NEED_TIMESBASE'}) {
e7c4906b 423 ++$skip{PL_timesbase};
e0cde265
SH
424}
425
dfc72f41 426unless ($define{'DEBUG_LEAKING_SCALARS'}) {
e7c4906b 427 ++$skip{PL_sv_serial};
dfc72f41
NC
428}
429
808e2276 430unless ($define{'DEBUG_LEAKING_SCALARS_FORK_DUMP'}) {
e7c4906b 431 ++$skip{PL_dumper_fd};
808e2276 432}
e7c4906b 433
c69033f2 434unless ($define{'PERL_DONT_CREATE_GVSV'}) {
e7c4906b 435 ++$skip{Perl_gv_SVadd};
c69033f2 436}
e7c4906b 437
ce582cee 438if ($define{'SPRINTF_RETURNS_STRLEN'}) {
e7c4906b 439 ++$skip{Perl_my_sprintf};
ce582cee 440}
e7c4906b 441
ca0c25f6 442unless ($define{'PERL_USES_PL_PIDSTATUS'}) {
e7c4906b 443 ++$skip{PL_pidstatus};
ca0c25f6 444}
808e2276 445
02ca4724 446unless ($define{'PERL_TRACK_MEMPOOL'}) {
e7c4906b 447 ++$skip{PL_memory_debug_header};
02ca4724
SP
448}
449
2cea2a29 450unless ($define{PERL_MAD}) {
e7c4906b 451 ++$skip{$_} foreach qw(
e3e31fab
SH
452 PL_madskills
453 PL_xmlfp
e7c4906b 454 );
e3e31fab
SH
455}
456
2a5adacc 457unless ($define{'MULTIPLICITY'}) {
e7c4906b 458 ++$skip{$_} foreach qw(
01523419 459 PL_interp_size
9e08d3a4 460 PL_interp_size_5_16_0
e7c4906b 461 );
2a5adacc
JD
462}
463
464unless ($define{'PERL_GLOBAL_STRUCT'}) {
e7c4906b 465 ++$skip{PL_global_struct_size};
2a5adacc
JD
466}
467
436dbe32 468unless ($define{'PERL_GLOBAL_STRUCT_PRIVATE'}) {
e7c4906b 469 ++$skip{$_} foreach qw(
436dbe32
SH
470 PL_my_cxt_keys
471 Perl_my_cxt_index
e7c4906b 472 );
436dbe32
SH
473}
474
bd1ae5d2 475unless ($define{HAS_MMAP}) {
e7c4906b 476 ++$skip{PL_mmap_page_size};
ac6bedea
JH
477}
478
bd1ae5d2 479if ($define{HAS_SIGACTION}) {
e7c4906b 480 ++$skip{PL_sig_trapped};
662667f1
CB
481
482 if ($ARGS{PLATFORM} eq 'vms') {
483 # FAKE_PERSISTENT_SIGNAL_HANDLERS defined as !defined(HAS_SIGACTION)
484 ++$skip{PL_sig_ignoring};
485 }
d97afc04
AT
486}
487
bdcba273 488unless ($define{USE_LOCALE_COLLATE}) {
e7c4906b 489 ++$skip{$_} foreach qw(
bdcba273
NC
490 PL_collation_ix
491 PL_collation_name
492 PL_collation_standard
493 PL_collxfrm_base
494 PL_collxfrm_mult
495 Perl_sv_collxfrm
496 Perl_sv_collxfrm_flags
e7c4906b 497 );
bdcba273
NC
498}
499
1f1ade4f 500unless ($define{USE_LOCALE_NUMERIC}) {
e7c4906b 501 ++$skip{$_} foreach qw(
1f1ade4f
NC
502 PL_numeric_local
503 PL_numeric_name
504 PL_numeric_radix_sv
505 PL_numeric_standard
e7c4906b 506 );
1f1ade4f
NC
507}
508
1ab20eaa 509unless ($define{HAVE_INTERP_INTERN}) {
e7c4906b 510 ++$skip{$_} foreach qw(
1ab20eaa
NC
511 Perl_sys_intern_clear
512 Perl_sys_intern_dup
513 Perl_sys_intern_init
514 PL_sys_intern
e7c4906b 515 );
1ab20eaa
NC
516}
517
47e4ddfc 518if ($define{HAS_SIGNBIT}) {
e7c4906b 519 ++$skip{Perl_signbit};
47e4ddfc
NC
520}
521
7766f137 522if ($define{'PERL_GLOBAL_STRUCT'}) {
321600e1 523 readvar('perlvars.h', \%skip);
8dd15074
NC
524 # This seems like the least ugly way to cope with the fact that PL_sh_path
525 # is mentioned in perlvar.h and globvar.sym, and always exported.
526 delete $skip{PL_sh_path};
944921d3 527 ++$export{Perl_GetVars};
0dc3711c 528 try_symbols(qw(PL_Vars PL_VarsPtr)) unless $ARGS{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
321600e1 535my @syms = qw(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);
0dc3711c 614if ($ARGS{PLATFORM} eq 'netware') {
a5564b91
JH
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
321600e1 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
321600e1
NC
732foreach (@syms) {
733 my $syms = $ARGS{TARG_DIR} . $_;
a6587d2d
NC
734 open my $global, '<', $syms or die "failed to open $syms: $!\n";
735 # Functions already have a Perl_ prefix
736 # Variables need a PL_ prefix
737 my $prefix = $syms =~ /var\.sym$/i ? 'PL_' : '';
738 while (<$global>) {
739 next unless /^([A-Za-z].*)/;
740 my $symbol = "$prefix$1";
944921d3 741 ++$export{$symbol} unless exists $skip{$symbol};
7766f137 742 }
7766f137 743}
0a753a76 744
22c35a8c 745# variables
0a753a76 746
87b9e160 747if ($define{'MULTIPLICITY'} && $define{PERL_GLOBAL_STRUCT}) {
321600e1 748 readvar('perlvars.h', \%export, sub { "Perl_" . $_[1] . $_[2] . "_ptr" });
1acb48c9 749 # XXX AIX seems to want the perlvars.h symbols, for some reason
0dc3711c 750 if ($ARGS{PLATFORM} eq 'aix' or $ARGS{PLATFORM} eq 'os2') { # OS/2 needs PL_thr_key
321600e1 751 readvar('perlvars.h', \%export);
51371543
GS
752 }
753}
754else {
755 unless ($define{'PERL_GLOBAL_STRUCT'}) {
321600e1 756 readvar('perlvars.h', \%export);
9df9a5cd 757 }
87b9e160 758 unless ($define{MULTIPLICITY}) {
321600e1 759 readvar('intrpvar.h', \%export);
87b9e160 760 }
51371543 761}
0a753a76 762
bf09e1bd 763# Oddities from PerlIO
01cace46
NC
764# All have alternate implementations in perlio.c, so always exist.
765# Should they be considered to be part of the API?
430d15ed 766try_symbols(qw(
bf09e1bd
NC
767 PerlIO_binmode
768 PerlIO_getpos
769 PerlIO_init
770 PerlIO_setpos
771 PerlIO_sprintf
bf09e1bd
NC
772 PerlIO_tmpfile
773 PerlIO_vsprintf
430d15ed 774 ));
ac4c12e7 775
0dc3711c 776if ($ARGS{PLATFORM} eq 'win32') {
7a95c549 777 try_symbols(qw(
5581753c
NC
778 setgid
779 setuid
780 win32_free_childdir
781 win32_free_childenv
782 win32_get_childdir
783 win32_get_childenv
784 win32_spawnvp
7a95c549 785 ));
5581753c
NC
786}
787
0dc3711c 788if ($ARGS{PLATFORM} =~ /^win(?:32|ce)$/) {
7a95c549 789 try_symbols(qw(
7766f137 790 Perl_init_os_extras
c44d3fdb 791 Perl_thread_create
7766f137 792 Perl_win32_init
23f519f0 793 Perl_win32_term
7766f137 794 RunPerl
5290524f 795 win32_async_check
7766f137
GS
796 win32_errno
797 win32_environ
7766f137
GS
798 win32_abort
799 win32_fstat
800 win32_stat
801 win32_pipe
802 win32_popen
803 win32_pclose
804 win32_rename
805 win32_setmode
11bb82ff 806 win32_chsize
7766f137
GS
807 win32_lseek
808 win32_tell
809 win32_dup
810 win32_dup2
811 win32_open
812 win32_close
813 win32_eof
4342f4d6 814 win32_isatty
7766f137
GS
815 win32_read
816 win32_write
7766f137
GS
817 win32_mkdir
818 win32_rmdir
819 win32_chdir
820 win32_flock
821 win32_execv
822 win32_execvp
823 win32_htons
824 win32_ntohs
825 win32_htonl
826 win32_ntohl
827 win32_inet_addr
828 win32_inet_ntoa
829 win32_socket
830 win32_bind
831 win32_listen
832 win32_accept
833 win32_connect
834 win32_send
835 win32_sendto
836 win32_recv
837 win32_recvfrom
838 win32_shutdown
839 win32_closesocket
840 win32_ioctlsocket
841 win32_setsockopt
842 win32_getsockopt
843 win32_getpeername
844 win32_getsockname
845 win32_gethostname
846 win32_gethostbyname
847 win32_gethostbyaddr
848 win32_getprotobyname
849 win32_getprotobynumber
850 win32_getservbyname
851 win32_getservbyport
852 win32_select
853 win32_endhostent
854 win32_endnetent
855 win32_endprotoent
856 win32_endservent
857 win32_getnetent
858 win32_getnetbyname
859 win32_getnetbyaddr
860 win32_getprotoent
861 win32_getservent
862 win32_sethostent
863 win32_setnetent
864 win32_setprotoent
865 win32_setservent
866 win32_getenv
867 win32_putenv
868 win32_perror
7766f137
GS
869 win32_malloc
870 win32_calloc
871 win32_realloc
872 win32_free
873 win32_sleep
874 win32_times
875 win32_access
876 win32_alarm
877 win32_chmod
878 win32_open_osfhandle
879 win32_get_osfhandle
880 win32_ioctl
881 win32_link
882 win32_unlink
883 win32_utime
57ab3dfe 884 win32_gettimeofday
7766f137
GS
885 win32_uname
886 win32_wait
887 win32_waitpid
888 win32_kill
889 win32_str_os_error
890 win32_opendir
891 win32_readdir
892 win32_telldir
893 win32_seekdir
894 win32_rewinddir
895 win32_closedir
896 win32_longpath
aa2b96ec 897 win32_ansipath
7766f137
GS
898 win32_os_id
899 win32_getpid
900 win32_crypt
901 win32_dynaload
df3728a2 902 win32_clearenv
00b02797
JH
903 win32_stdin
904 win32_stdout
905 win32_stderr
906 win32_ferror
907 win32_feof
908 win32_strerror
909 win32_fprintf
910 win32_printf
911 win32_vfprintf
912 win32_vprintf
913 win32_fread
914 win32_fwrite
915 win32_fopen
916 win32_fdopen
917 win32_freopen
918 win32_fclose
919 win32_fputs
920 win32_fputc
921 win32_ungetc
922 win32_getc
923 win32_fileno
924 win32_clearerr
925 win32_fflush
926 win32_ftell
927 win32_fseek
928 win32_fgetpos
929 win32_fsetpos
930 win32_rewind
931 win32_tmpfile
932 win32_setbuf
933 win32_setvbuf
934 win32_flushall
935 win32_fcloseall
936 win32_fgets
937 win32_gets
938 win32_fgetc
939 win32_putc
940 win32_puts
941 win32_getchar
942 win32_putchar
7a95c549 943 ));
0dc3711c 944 if ($ARGS{CCTYPE} eq "BORLAND") {
7a95c549 945 try_symbols('_matherr');
3a00b83e 946 }
549a6b10 947}
0dc3711c 948elsif ($ARGS{PLATFORM} eq 'vms') {
71afeaec
NC
949 try_symbols(qw(
950 Perl_cando
951 Perl_cando_by_name
952 Perl_closedir
953 Perl_csighandler_init
954 Perl_do_rmdir
955 Perl_fileify_dirspec
956 Perl_fileify_dirspec_ts
957 Perl_fileify_dirspec_utf8
958 Perl_fileify_dirspec_utf8_ts
959 Perl_flex_fstat
960 Perl_flex_lstat
961 Perl_flex_stat
962 Perl_kill_file
963 Perl_my_chdir
964 Perl_my_chmod
965 Perl_my_crypt
966 Perl_my_endpwent
967 Perl_my_fclose
968 Perl_my_fdopen
969 Perl_my_fgetname
970 Perl_my_flush
971 Perl_my_fwrite
972 Perl_my_gconvert
973 Perl_my_getenv
974 Perl_my_getenv_len
975 Perl_my_getlogin
976 Perl_my_getpwnam
977 Perl_my_getpwuid
978 Perl_my_gmtime
979 Perl_my_kill
980 Perl_my_localtime
981 Perl_my_mkdir
982 Perl_my_sigaction
983 Perl_my_symlink
984 Perl_my_time
985 Perl_my_tmpfile
986 Perl_my_trnlnm
987 Perl_my_utime
988 Perl_my_waitpid
989 Perl_opendir
990 Perl_pathify_dirspec
991 Perl_pathify_dirspec_ts
992 Perl_pathify_dirspec_utf8
993 Perl_pathify_dirspec_utf8_ts
994 Perl_readdir
995 Perl_readdir_r
996 Perl_rename
997 Perl_rmscopy
998 Perl_rmsexpand
999 Perl_rmsexpand_ts
1000 Perl_rmsexpand_utf8
1001 Perl_rmsexpand_utf8_ts
1002 Perl_seekdir
1003 Perl_sig_to_vmscondition
1004 Perl_telldir
1005 Perl_tounixpath
1006 Perl_tounixpath_ts
1007 Perl_tounixpath_utf8
1008 Perl_tounixpath_utf8_ts
1009 Perl_tounixspec
1010 Perl_tounixspec_ts
1011 Perl_tounixspec_utf8
1012 Perl_tounixspec_utf8_ts
1013 Perl_tovmspath
1014 Perl_tovmspath_ts
1015 Perl_tovmspath_utf8
1016 Perl_tovmspath_utf8_ts
1017 Perl_tovmsspec
1018 Perl_tovmsspec_ts
1019 Perl_tovmsspec_utf8
1020 Perl_tovmsspec_utf8_ts
1021 Perl_trim_unixpath
1022 Perl_vms_case_tolerant
1023 Perl_vms_do_aexec
1024 Perl_vms_do_exec
1025 Perl_vms_image_init
1026 Perl_vms_realpath
1027 Perl_vmssetenv
1028 Perl_vmssetuserlnm
1029 Perl_vmstrnenv
1030 PerlIO_openn
1031 ));
1032}
0dc3711c 1033elsif ($ARGS{PLATFORM} eq 'os2') {
71afeaec
NC
1034 try_symbols(qw(
1035 ctermid
1036 get_sysinfo
1037 Perl_OS2_init
1038 Perl_OS2_init3
1039 Perl_OS2_term
1040 OS2_Perl_data
1041 dlopen
1042 dlsym
1043 dlerror
1044 dlclose
1045 dup2
1046 dup
1047 my_tmpfile
1048 my_tmpnam
1049 my_flock
1050 my_rmdir
1051 my_mkdir
1052 my_getpwuid
1053 my_getpwnam
1054 my_getpwent
1055 my_setpwent
1056 my_endpwent
1057 fork_with_resources
1058 croak_with_os2error
1059 setgrent
1060 endgrent
1061 getgrent
1062 malloc_mutex
1063 threads_mutex
1064 nthreads
1065 nthreads_cond
1066 os2_cond_wait
1067 os2_stat
1068 os2_execname
1069 async_mssleep
1070 msCounter
1071 InfoTable
1072 pthread_join
1073 pthread_create
1074 pthread_detach
1075 XS_Cwd_change_drive
1076 XS_Cwd_current_drive
1077 XS_Cwd_extLibpath
1078 XS_Cwd_extLibpath_set
1079 XS_Cwd_sys_abspath
1080 XS_Cwd_sys_chdir
1081 XS_Cwd_sys_cwd
1082 XS_Cwd_sys_is_absolute
1083 XS_Cwd_sys_is_relative
1084 XS_Cwd_sys_is_rooted
1085 XS_DynaLoader_mod2fname
1086 XS_File__Copy_syscopy
1087 Perl_Register_MQ
1088 Perl_Deregister_MQ
1089 Perl_Serve_Messages
1090 Perl_Process_Messages
1091 init_PMWIN_entries
1092 PMWIN_entries
1093 Perl_hab_GET
1094 loadByOrdinal
1095 pExtFCN
1096 os2error
1097 ResetWinError
1098 CroakWinError
1099 PL_do_undump
1100 ));
3cfae81b 1101}
0dc3711c 1102elsif ($ARGS{PLATFORM} eq 'netware') {
7a95c549 1103 try_symbols(qw(
2986a63f
JH
1104 Perl_init_os_extras
1105 Perl_thread_create
1106 Perl_nw5_init
1107 RunPerl
1108 AllocStdPerl
1109 FreeStdPerl
1110 do_spawn2
1111 do_aspawn
1112 nw_uname
1113 nw_stdin
1114 nw_stdout
1115 nw_stderr
1116 nw_feof
1117 nw_ferror
1118 nw_fopen
1119 nw_fclose
1120 nw_clearerr
1121 nw_getc
1122 nw_fgets
1123 nw_fputc
1124 nw_fputs
1125 nw_fflush
1126 nw_ungetc
1127 nw_fileno
1128 nw_fdopen
1129 nw_freopen
1130 nw_fread
1131 nw_fwrite
1132 nw_setbuf
1133 nw_setvbuf
1134 nw_vfprintf
1135 nw_ftell
1136 nw_fseek
1137 nw_rewind
1138 nw_tmpfile
1139 nw_fgetpos
1140 nw_fsetpos
1141 nw_dup
1142 nw_access
1143 nw_chmod
1144 nw_chsize
1145 nw_close
1146 nw_dup2
1147 nw_flock
1148 nw_isatty
1149 nw_link
1150 nw_lseek
1151 nw_stat
1152 nw_mktemp
1153 nw_open
1154 nw_read
1155 nw_rename
1156 nw_setmode
1157 nw_unlink
1158 nw_utime
1159 nw_write
1160 nw_chdir
1161 nw_rmdir
1162 nw_closedir
1163 nw_opendir
1164 nw_readdir
1165 nw_rewinddir
1166 nw_seekdir
1167 nw_telldir
1168 nw_htonl
1169 nw_htons
1170 nw_ntohl
1171 nw_ntohs
1172 nw_accept
1173 nw_bind
1174 nw_connect
1175 nw_endhostent
1176 nw_endnetent
1177 nw_endprotoent
1178 nw_endservent
1179 nw_gethostbyaddr
1180 nw_gethostbyname
1181 nw_gethostent
1182 nw_gethostname
1183 nw_getnetbyaddr
1184 nw_getnetbyname
1185 nw_getnetent
1186 nw_getpeername
1187 nw_getprotobyname
1188 nw_getprotobynumber
1189 nw_getprotoent
1190 nw_getservbyname
1191 nw_getservbyport
1192 nw_getservent
1193 nw_getsockname
1194 nw_getsockopt
1195 nw_inet_addr
1196 nw_listen
1197 nw_socket
1198 nw_recv
1199 nw_recvfrom
1200 nw_select
1201 nw_send
1202 nw_sendto
1203 nw_sethostent
1204 nw_setnetent
1205 nw_setprotoent
1206 nw_setservent
3a0827a6 1207 nw_setsockopt
4d76e4b4 1208 nw_inet_ntoa
2986a63f
JH
1209 nw_shutdown
1210 nw_crypt
1211 nw_execvp
1212 nw_kill
1213 nw_Popen
1214 nw_Pclose
1215 nw_Pipe
1216 nw_times
1217 nw_waitpid
1218 nw_getpid
1219 nw_spawnvp
1220 nw_os_id
1221 nw_open_osfhandle
1222 nw_get_osfhandle
1223 nw_abort
1224 nw_sleep
1225 nw_wait
1226 nw_dynaload
1227 nw_strerror
1228 fnFpSetMode
1229 fnInsertHashListAddrs
1230 fnGetHashListAddrs
1231 Perl_deb
011f1a1a
JH
1232 Perl_sv_setsv
1233 Perl_sv_catsv
1234 Perl_sv_catpvn
1235 Perl_sv_2pv
f355267c
JH
1236 nw_freeenviron
1237 Remove_Thread_Ctx
7a95c549 1238 ));
2986a63f 1239}
22239a37 1240
9661ac31
NC
1241# When added this code was only run for Win32 and WinCE
1242# Currently only Win32 links static extensions into the shared library.
1243# The WinCE makefile doesn't appear to support static extensions, so this code
1244# can't have any effect there.
1245# The NetWare Makefile doesn't support static extensions (and hardcodes the
1246# list of dynamic extensions, and the rules to build them)
1247# For *nix (and presumably OS/2) with a shared libperl, Makefile.SH compiles
1248# static extensions with -fPIC, but links them to perl, not libperl.so
1249# The VMS build scripts don't yet implement static extensions at all.
1250
0dc3711c 1251if ($ARGS{PLATFORM} =~ /^win(?:32|ce)$/) {
9661ac31 1252 # records of type boot_module for statically linked modules (except Dynaloader)
c051ff4c 1253 my $static_ext = $Config{static_ext} // "";
9661ac31
NC
1254 $static_ext =~ s/\//__/g;
1255 $static_ext =~ s/\bDynaLoader\b//;
1256 try_symbols(map {"boot_$_"} grep {/\S/} split /\s+/, $static_ext);
1257 try_symbols("init_Win32CORE") if $static_ext =~ /\bWin32CORE\b/;
1258}
9fb265f7 1259
0dc3711c 1260if ($ARGS{PLATFORM} eq 'os2') {
71afeaec
NC
1261 my (%mapped, @missing);
1262 open MAP, 'miniperl.map' or die 'Cannot read miniperl.map';
1263 /^\s*[\da-f:]+\s+(\w+)/i and $mapped{$1}++ foreach <MAP>;
1264 close MAP or die 'Cannot close miniperl.map';
1265
1266 @missing = grep { !exists $mapped{$_} }
1267 keys %export;
1268 @missing = grep { !exists $exportperlmalloc{$_} } @missing;
1269 delete $export{$_} foreach @missing;
1270}
1271
d6035849
NC
1272###############################################################################
1273
1274# Now all symbols should be defined because next we are going to output them.
1275
1276# Start with platform specific headers:
1277
0dc3711c 1278if ($ARGS{PLATFORM} =~ /^win(?:32|ce)$/) {
d9f179d8
NC
1279 my $dll = $define{PERL_DLL} ? $define{PERL_DLL} =~ s/\.dll$//ir
1280 : "perl$Config{api_revision}$Config{api_version}";
d6035849
NC
1281 print "LIBRARY $dll\n";
1282 # The DESCRIPTION module definition file statement is not supported
1283 # by VC7 onwards.
0dc3711c 1284 if ($ARGS{CCTYPE} =~ /^(?:MSVC60|GCC|BORLAND)$/) {
d6035849
NC
1285 print "DESCRIPTION 'Perl interpreter'\n";
1286 }
1287 print "EXPORTS\n";
1288}
0dc3711c 1289elsif ($ARGS{PLATFORM} eq 'os2') {
d6035849 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}
0dc3711c 1305elsif ($ARGS{PLATFORM} eq 'aix') {
d6035849
NC
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}
0dc3711c
NC
1316elsif ($ARGS{PLATFORM} eq 'netware') {
1317 if ($ARGS{FILETYPE} eq 'def') {
d9f179d8 1318 print "LIBRARY perl$Config{api_revision}$Config{api_version}\n";
d6035849
NC
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) {
0dc3711c
NC
1327 if ($ARGS{PLATFORM} =~ /^win(?:32|ce)$/) {
1328 $symbol = "_$symbol" if $ARGS{CCTYPE} eq 'BORLAND';
520c758a 1329 print "\t$symbol\n";
7766f137 1330 }
0dc3711c 1331 elsif ($ARGS{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 }
0dc3711c 1339 elsif ($ARGS{PLATFORM} eq 'netware') {
ed463ba8
NC
1340 print "\t$symbol,\n";
1341 } else {
549a6b10
JH
1342 print "$symbol\n";
1343 }
ed463ba8
NC
1344}
1345
1346# Then platform specific footers.
1347
0dc3711c 1348if ($ARGS{PLATFORM} eq 'os2') {
ed463ba8
NC
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;