This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fixup exports in non -DDEBUGGING case
[perl5.git] / win32 / makedef.pl
CommitLineData
0a753a76 1#!../miniperl
2
3# Written: 10 April 1996 Gary Ng (71564.1743@compuserve.com)
4
5# Create the export list for perl.
6# Needed by WIN32 for creating perl.dll
7# based on perl_exp.SH in the main perl distribution directory
8
9# This simple program relys on 'global.sym' being up to date
10# with all of the global symbols that a dynamicly link library
11# might want to access.
12
13# There is some symbol defined in global.sym and interp.sym
14# that does not present in the WIN32 port but there is no easy
84902520 15# way to find them so I just put a exception list here
0a753a76 16
d55594ae
GS
17while (@ARGV && $ARGV[0] =~ /^-/)
18 {
19 my $flag = shift;
20 $define{$1} = 1 if ($flag =~ /^-D(\w+)$/);
21 }
22
bbc8f9de
NIS
23open(CFG,'config.h') || die "Cannot open config.h:$!";
24while (<CFG>)
25 {
26 $define{$1} = 1 if /^\s*#\s*define\s+(MYMALLOC)\b/;
27 }
28close(CFG);
29
d55594ae
GS
30warn join(' ',keys %define)."\n";
31
3e3baf6d
TB
32my $CCTYPE = shift || "MSVC";
33
04dc04aa
NIS
34if ($CCTYPE ne 'GCC')
35 {
36 print "LIBRARY Perl\n";
37 print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
38 print "CODE LOADONCALL\n";
39 print "DATA LOADONCALL NONSHARED MULTIPLE\n";
40 }
bbc8f9de
NIS
41print "EXPORTS\n";
42
0a753a76 43$skip_sym=<<'!END!OF!SKIP!';
0a753a76 44Perl_block_type
0a753a76 45Perl_additem
46Perl_cast_ulong
47Perl_check_uni
48Perl_checkcomma
49Perl_chsize
50Perl_ck_aelem
51Perl_cryptseen
52Perl_cx_dump
53Perl_deb
54Perl_deb_growlevel
55Perl_debop
56Perl_debprofdump
57Perl_debstack
58Perl_debstackptrs
59Perl_do_ipcctl
60Perl_do_ipcget
61Perl_do_msgrcv
62Perl_do_msgsnd
63Perl_do_semop
64Perl_do_shmio
65Perl_doeval
66Perl_dofindlabel
67Perl_dopoptoeval
68Perl_dump_eval
69Perl_dump_fds
70Perl_dump_form
71Perl_dump_gv
72Perl_dump_mstats
73Perl_dump_op
74Perl_dump_packsubs
75Perl_dump_pm
76Perl_dump_sub
77Perl_expectterm
78Perl_fetch_gv
79Perl_fetch_io
80Perl_force_ident
81Perl_force_next
82Perl_force_word
83Perl_hv_stashpv
84Perl_intuit_more
d55594ae 85Perl_init_thread_intern
0a753a76 86Perl_know_next
87Perl_modkids
88Perl_mstats
89Perl_my_bzero
90Perl_my_htonl
91Perl_my_ntohl
92Perl_my_swap
93Perl_my_chsize
94Perl_newXSUB
95Perl_no_fh_allowed
96Perl_no_op
97Perl_nointrp
98Perl_nomem
99Perl_pp_cswitch
100Perl_pp_entersubr
101Perl_pp_evalonce
102Perl_pp_interp
103Perl_pp_map
104Perl_pp_nswitch
105Perl_q
d55594ae 106Perl_rcsid
0a753a76 107Perl_reall_srchlen
108Perl_regdump
109Perl_regfold
110Perl_regmyendp
111Perl_regmyp_size
112Perl_regmystartp
113Perl_regnarrate
114Perl_regprop
115Perl_same_dirent
116Perl_saw_return
117Perl_scan_const
118Perl_scan_formline
119Perl_scan_heredoc
120Perl_scan_ident
121Perl_scan_inputsymbol
122Perl_scan_pat
123Perl_scan_prefix
124Perl_scan_str
125Perl_scan_subst
126Perl_scan_trans
127Perl_scan_word
68dc0745 128Perl_setenv_getix
0a753a76 129Perl_skipspace
130Perl_sublex_done
131Perl_sublex_start
0a753a76 132Perl_sv_ref
133Perl_sv_setptrobj
134Perl_timesbuf
135Perl_too_few_arguments
136Perl_too_many_arguments
137Perl_unlnk
138Perl_wait4pid
139Perl_watch
140Perl_yyname
141Perl_yyrule
142allgvs
143curblock
0a753a76 144curcsv
0a753a76 145lastretstr
146mystack_mark
147perl_init_ext
148perl_requirepv
0a753a76 149stack
ff0cee69 150statusvalue_vms
0a753a76 151Perl_safexcalloc
152Perl_safexmalloc
153Perl_safexfree
154Perl_safexrealloc
68dc0745 155Perl_my_memcmp
8b10511d 156Perl_my_memset
68dc0745 157Perl_cshlen
158Perl_cshname
0da3735a 159Perl_opsave
0a753a76 160!END!OF!SKIP!
161
c69f112c
NIS
162if ($CCTYPE eq 'GCC')
163 {
164 $skip_sym .= "Perl_na\n";
165 }
166
bbc8f9de
NIS
167if ($define{'MYMALLOC'})
168 {
169 $skip_sym .= <<'!END!OF!SKIP!';
170Perl_safefree
171Perl_safemalloc
172Perl_saferealloc
173Perl_safecalloc
174!END!OF!SKIP!
175 emit_symbol('Perl_malloc');
176 emit_symbol('Perl_free');
177 emit_symbol('Perl_realloc');
178 emit_symbol('Perl_calloc');
179 }
180
d55594ae
GS
181unless ($define{'USE_THREADS'})
182 {
183 $skip_sym .= <<'!END!OF!SKIP!';
184Perl_condpair_magic
185Perl_thr_key
186Perl_sv_mutex
187Perl_malloc_mutex
188Perl_eval_mutex
189Perl_eval_cond
190Perl_eval_owner
191Perl_threads_mutex
32f822de
GS
192Perl_new_struct_thread
193Perl_nthreads
d55594ae 194Perl_nthreads_cond
32f822de 195Perl_per_thread_magicals
d4cce5f1
NIS
196Perl_thread_create
197Perl_find_threadsv
198Perl_threadsv_names
32f822de 199Perl_thrsv
d55594ae
GS
200Perl_unlock_condpair
201Perl_vtbl_mutex
202Perl_magic_mutexfree
203Perl_sv_iv
204Perl_sv_nv
205Perl_sv_true
206Perl_sv_uv
207Perl_sv_pvn
208Perl_newRV_noinc
209!END!OF!SKIP!
d4cce5f1 210
d55594ae
GS
211 }
212
d4cce5f1 213if ($define{'USE_THREADS'} || $define{'MULTIPLICITY'})
d55594ae 214 {
d4cce5f1 215 open(THREAD,"<../thrdvar.h") || die "Cannot open ../thrdvar.h:$!";
d55594ae
GS
216 while (<THREAD>)
217 {
d4cce5f1
NIS
218 if (/\bPERLVARI?\(T(\w+)/)
219 {
220 $skip_sym .= "Perl_".$1."\n";
221 }
d55594ae
GS
222 }
223 close(THREAD);
d55594ae
GS
224 }
225
d4cce5f1 226if ($define{'MULTIPLICITY'})
d55594ae 227 {
d4cce5f1
NIS
228 open(THREAD,"<../intrpvar.h") || die "Cannot open ../intrpvar.h:$!";
229 while (<THREAD>)
230 {
231 if (/\bPERLVARI?\(I(\w+)/)
232 {
233 $skip_sym .= "Perl_".$1."\n";
234 }
235 }
236 close(THREAD);
237 }
d55594ae 238
36c15d3f
NIS
239unless ($define{'DEBUGGING'})
240 {
241 $skip_sym .= "Perl_runops_debug\n";
242 $skip_sym .= "Perl_sv_peek\n";
243 }
244
0a753a76 245# All symbols have a Perl_ prefix because that's what embed.h
246# sticks in front of them.
247
248
0a753a76 249open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!;
250while (<GLOBAL>) {
251 my $symbol;
252 next if (!/^[A-Za-z]/);
253 next if (/_amg[ \t]*$/);
254 $symbol = "Perl_$_";
255 next if ($skip_sym =~ m/$symbol/m);
3e3baf6d
TB
256 emit_symbol($symbol);
257}
0a753a76 258close(GLOBAL);
259
260# also add symbols from interp.sym
261# They are only needed if -DMULTIPLICITY is not set but it
262# doesn't hurt to include them anyway.
263# these don't have Perl prefix
264
265open (INTERP, "<../interp.sym") || die "failed to open interp.sym" . $!;
266while (<INTERP>) {
267 my $symbol;
268 next if (!/^[A-Za-z]/);
269 next if (/_amg[ \t]*$/);
270 $symbol = $_;
271 next if ($skip_sym =~ m/$symbol/m);
272 #print "\t$symbol";
3e3baf6d
TB
273 emit_symbol("Perl_" . $symbol);
274}
0a753a76 275
276#close(INTERP);
277
278while (<DATA>) {
279 my $symbol;
280 next if (!/^[A-Za-z]/);
281 next if (/^#/);
a868473f 282 s/\r//g;
0a753a76 283 $symbol = $_;
284 next if ($skip_sym =~ m/^$symbol/m);
d55594ae
GS
285 $symbol = "Perl_".$symbol if ($define{'USE_THISPTR'}
286 && $symbol =~ /^perl/);
3e3baf6d
TB
287 emit_symbol($symbol);
288}
289
290sub emit_symbol {
291 my $symbol = shift;
292 chomp $symbol;
293 if ($CCTYPE eq "BORLAND") {
294 # workaround Borland quirk by exporting both the straight
84902520
TB
295 # name and a name with leading underscore. Note the
296 # alias *must* come after the symbol itself, if both
297 # are to be exported. (Linker bug?)
3e3baf6d 298 print "\t_$symbol\n";
84902520 299 print "\t$symbol = _$symbol\n";
3e3baf6d
TB
300 }
301 else {
84902520
TB
302 # for binary coexistence, export both the symbol and
303 # alias with leading underscore
3e3baf6d 304 print "\t$symbol\n";
84902520 305 print "\t_$symbol = $symbol\n";
3e3baf6d
TB
306 }
307}
0a753a76 308
3091;
310__DATA__
311# extra globals not included above.
312perl_init_i18nl10n
313perl_init_ext
314perl_alloc
315perl_construct
316perl_destruct
317perl_free
318perl_parse
319perl_run
320perl_get_sv
321perl_get_av
322perl_get_hv
323perl_get_cv
324perl_call_argv
325perl_call_pv
326perl_call_method
327perl_call_sv
10dd38fc
GS
328perl_require_pv
329perl_eval_pv
330perl_eval_sv
d28b3ca3 331boot_DynaLoader
d55594ae 332Perl_thread_create
68dc0745 333win32_errno
96e4d5b1 334win32_environ
68dc0745 335win32_stdin
336win32_stdout
96e4d5b1 337win32_stderr
68dc0745 338win32_ferror
339win32_feof
340win32_strerror
341win32_fprintf
342win32_printf
343win32_vfprintf
96e4d5b1 344win32_vprintf
68dc0745 345win32_fread
346win32_fwrite
347win32_fopen
348win32_fdopen
349win32_freopen
350win32_fclose
351win32_fputs
352win32_fputc
353win32_ungetc
354win32_getc
355win32_fileno
356win32_clearerr
357win32_fflush
358win32_ftell
359win32_fseek
360win32_fgetpos
361win32_fsetpos
362win32_rewind
363win32_tmpfile
364win32_abort
365win32_fstat
96e4d5b1 366win32_stat
68dc0745 367win32_pipe
368win32_popen
369win32_pclose
370win32_setmode
96e4d5b1 371win32_lseek
372win32_tell
68dc0745 373win32_dup
374win32_dup2
96e4d5b1 375win32_open
376win32_close
377win32_eof
68dc0745 378win32_read
379win32_write
3e3baf6d 380win32_spawnvp
5aabfad6 381win32_mkdir
382win32_rmdir
383win32_chdir
c90c0ff4 384win32_flock
6890e559 385win32_execvp
54310121 386win32_htons
387win32_ntohs
388win32_htonl
389win32_ntohl
390win32_inet_addr
391win32_inet_ntoa
392win32_socket
393win32_bind
394win32_listen
395win32_accept
396win32_connect
397win32_send
398win32_sendto
399win32_recv
400win32_recvfrom
401win32_shutdown
3a25acb4 402win32_closesocket
54310121 403win32_ioctlsocket
404win32_setsockopt
405win32_getsockopt
406win32_getpeername
407win32_getsockname
408win32_gethostname
409win32_gethostbyname
410win32_gethostbyaddr
411win32_getprotobyname
412win32_getprotobynumber
413win32_getservbyname
414win32_getservbyport
415win32_select
416win32_endhostent
417win32_endnetent
418win32_endprotoent
419win32_endservent
420win32_getnetent
421win32_getnetbyname
422win32_getnetbyaddr
423win32_getprotoent
424win32_getservent
425win32_sethostent
426win32_setnetent
427win32_setprotoent
428win32_setservent
ad2e33dc 429win32_getenv
84902520
TB
430win32_perror
431win32_setbuf
432win32_setvbuf
433win32_flushall
434win32_fcloseall
435win32_fgets
436win32_gets
437win32_fgetc
438win32_putc
439win32_puts
440win32_getchar
441win32_putchar
442win32_malloc
443win32_calloc
444win32_realloc
445win32_free
f3986ebb
GS
446win32_sleep
447win32_times
448win32_alarm
65e48ea9
GS
449win32_open_osfhandle
450win32_get_osfhandle
ad2e33dc 451Perl_win32_init
f3986ebb 452Perl_init_os_extras
9811a7d7 453Perl_getTHR
0fefa03b 454Perl_setTHR
84902520 455RunPerl