This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Disable hard-coded -DDEBUGGING
[perl5.git] / win32 / makedef.pl
CommitLineData
0a753a76
PP
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
PP
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
PP
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
PP
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
PP
129Perl_skipspace
130Perl_sublex_done
131Perl_sublex_start
0a753a76
PP
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
PP
145lastretstr
146mystack_mark
147perl_init_ext
148perl_requirepv
0a753a76 149stack
ff0cee69 150statusvalue_vms
0a753a76
PP
151Perl_safexcalloc
152Perl_safexmalloc
153Perl_safexfree
154Perl_safexrealloc
68dc0745 155Perl_my_memcmp
8b10511d 156Perl_my_memset
68dc0745
PP
157Perl_cshlen
158Perl_cshname
0da3735a 159Perl_opsave
0a753a76
PP
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
0a753a76
PP
239# All symbols have a Perl_ prefix because that's what embed.h
240# sticks in front of them.
241
242
0a753a76
PP
243open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!;
244while (<GLOBAL>) {
245 my $symbol;
246 next if (!/^[A-Za-z]/);
247 next if (/_amg[ \t]*$/);
248 $symbol = "Perl_$_";
249 next if ($skip_sym =~ m/$symbol/m);
3e3baf6d
TB
250 emit_symbol($symbol);
251}
0a753a76
PP
252close(GLOBAL);
253
254# also add symbols from interp.sym
255# They are only needed if -DMULTIPLICITY is not set but it
256# doesn't hurt to include them anyway.
257# these don't have Perl prefix
258
259open (INTERP, "<../interp.sym") || die "failed to open interp.sym" . $!;
260while (<INTERP>) {
261 my $symbol;
262 next if (!/^[A-Za-z]/);
263 next if (/_amg[ \t]*$/);
264 $symbol = $_;
265 next if ($skip_sym =~ m/$symbol/m);
266 #print "\t$symbol";
3e3baf6d
TB
267 emit_symbol("Perl_" . $symbol);
268}
0a753a76
PP
269
270#close(INTERP);
271
272while (<DATA>) {
273 my $symbol;
274 next if (!/^[A-Za-z]/);
275 next if (/^#/);
a868473f 276 s/\r//g;
0a753a76
PP
277 $symbol = $_;
278 next if ($skip_sym =~ m/^$symbol/m);
d55594ae
GS
279 $symbol = "Perl_".$symbol if ($define{'USE_THISPTR'}
280 && $symbol =~ /^perl/);
3e3baf6d
TB
281 emit_symbol($symbol);
282}
283
284sub emit_symbol {
285 my $symbol = shift;
286 chomp $symbol;
287 if ($CCTYPE eq "BORLAND") {
288 # workaround Borland quirk by exporting both the straight
84902520
TB
289 # name and a name with leading underscore. Note the
290 # alias *must* come after the symbol itself, if both
291 # are to be exported. (Linker bug?)
3e3baf6d 292 print "\t_$symbol\n";
84902520 293 print "\t$symbol = _$symbol\n";
3e3baf6d
TB
294 }
295 else {
84902520
TB
296 # for binary coexistence, export both the symbol and
297 # alias with leading underscore
3e3baf6d 298 print "\t$symbol\n";
84902520 299 print "\t_$symbol = $symbol\n";
3e3baf6d
TB
300 }
301}
0a753a76
PP
302
3031;
304__DATA__
305# extra globals not included above.
306perl_init_i18nl10n
307perl_init_ext
308perl_alloc
309perl_construct
310perl_destruct
311perl_free
312perl_parse
313perl_run
314perl_get_sv
315perl_get_av
316perl_get_hv
317perl_get_cv
318perl_call_argv
319perl_call_pv
320perl_call_method
321perl_call_sv
10dd38fc
GS
322perl_require_pv
323perl_eval_pv
324perl_eval_sv
d28b3ca3 325boot_DynaLoader
d55594ae 326Perl_thread_create
68dc0745 327win32_errno
96e4d5b1 328win32_environ
68dc0745
PP
329win32_stdin
330win32_stdout
96e4d5b1 331win32_stderr
68dc0745
PP
332win32_ferror
333win32_feof
334win32_strerror
335win32_fprintf
336win32_printf
337win32_vfprintf
96e4d5b1 338win32_vprintf
68dc0745
PP
339win32_fread
340win32_fwrite
341win32_fopen
342win32_fdopen
343win32_freopen
344win32_fclose
345win32_fputs
346win32_fputc
347win32_ungetc
348win32_getc
349win32_fileno
350win32_clearerr
351win32_fflush
352win32_ftell
353win32_fseek
354win32_fgetpos
355win32_fsetpos
356win32_rewind
357win32_tmpfile
358win32_abort
359win32_fstat
96e4d5b1 360win32_stat
68dc0745
PP
361win32_pipe
362win32_popen
363win32_pclose
364win32_setmode
96e4d5b1
PP
365win32_lseek
366win32_tell
68dc0745
PP
367win32_dup
368win32_dup2
96e4d5b1
PP
369win32_open
370win32_close
371win32_eof
68dc0745
PP
372win32_read
373win32_write
3e3baf6d 374win32_spawnvp
5aabfad6
PP
375win32_mkdir
376win32_rmdir
377win32_chdir
c90c0ff4 378win32_flock
6890e559 379win32_execvp
54310121
PP
380win32_htons
381win32_ntohs
382win32_htonl
383win32_ntohl
384win32_inet_addr
385win32_inet_ntoa
386win32_socket
387win32_bind
388win32_listen
389win32_accept
390win32_connect
391win32_send
392win32_sendto
393win32_recv
394win32_recvfrom
395win32_shutdown
3a25acb4 396win32_closesocket
54310121
PP
397win32_ioctlsocket
398win32_setsockopt
399win32_getsockopt
400win32_getpeername
401win32_getsockname
402win32_gethostname
403win32_gethostbyname
404win32_gethostbyaddr
405win32_getprotobyname
406win32_getprotobynumber
407win32_getservbyname
408win32_getservbyport
409win32_select
410win32_endhostent
411win32_endnetent
412win32_endprotoent
413win32_endservent
414win32_getnetent
415win32_getnetbyname
416win32_getnetbyaddr
417win32_getprotoent
418win32_getservent
419win32_sethostent
420win32_setnetent
421win32_setprotoent
422win32_setservent
ad2e33dc 423win32_getenv
84902520
TB
424win32_perror
425win32_setbuf
426win32_setvbuf
427win32_flushall
428win32_fcloseall
429win32_fgets
430win32_gets
431win32_fgetc
432win32_putc
433win32_puts
434win32_getchar
435win32_putchar
436win32_malloc
437win32_calloc
438win32_realloc
439win32_free
f3986ebb
GS
440win32_sleep
441win32_times
442win32_alarm
65e48ea9
GS
443win32_open_osfhandle
444win32_get_osfhandle
ad2e33dc 445Perl_win32_init
f3986ebb 446Perl_init_os_extras
9811a7d7 447Perl_getTHR
0fefa03b 448Perl_setTHR
84902520 449RunPerl