This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[inseperable differences up to perl 5.004_02]
[perl5.git] / win32 / makedef.pl
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
15 # way to find them so I just put a exception list here
16
17 my $CCTYPE = shift || "MSVC";
18
19 $skip_sym=<<'!END!OF!SKIP!';
20 Perl_SvIV
21 Perl_SvNV
22 Perl_SvTRUE
23 Perl_SvUV
24 Perl_block_type
25 Perl_sv_pvn
26 Perl_additem
27 Perl_cast_ulong
28 Perl_check_uni
29 Perl_checkcomma
30 Perl_chsize
31 Perl_ck_aelem
32 Perl_cryptseen
33 Perl_cx_dump
34 Perl_deb
35 Perl_deb_growlevel
36 Perl_debop
37 Perl_debprofdump
38 Perl_debstack
39 Perl_debstackptrs
40 Perl_do_ipcctl
41 Perl_do_ipcget
42 Perl_do_msgrcv
43 Perl_do_msgsnd
44 Perl_do_semop
45 Perl_do_shmio
46 Perl_doeval
47 Perl_dofindlabel
48 Perl_dopoptoeval
49 Perl_dump_eval
50 Perl_dump_fds
51 Perl_dump_form
52 Perl_dump_gv
53 Perl_dump_mstats
54 Perl_dump_op
55 Perl_dump_packsubs
56 Perl_dump_pm
57 Perl_dump_sub
58 Perl_expectterm
59 Perl_fetch_gv
60 Perl_fetch_io
61 Perl_force_ident
62 Perl_force_next
63 Perl_force_word
64 Perl_hv_stashpv
65 Perl_intuit_more
66 Perl_know_next
67 Perl_modkids
68 Perl_mstats
69 Perl_my_bzero
70 Perl_my_htonl
71 Perl_my_ntohl
72 Perl_my_swap
73 Perl_my_chsize
74 Perl_newXSUB
75 Perl_no_fh_allowed
76 Perl_no_op
77 Perl_nointrp
78 Perl_nomem
79 Perl_pp_cswitch
80 Perl_pp_entersubr
81 Perl_pp_evalonce
82 Perl_pp_interp
83 Perl_pp_map
84 Perl_pp_nswitch
85 Perl_q
86 Perl_reall_srchlen
87 Perl_regdump
88 Perl_regfold
89 Perl_regmyendp
90 Perl_regmyp_size
91 Perl_regmystartp
92 Perl_regnarrate
93 Perl_regprop
94 Perl_same_dirent
95 Perl_saw_return
96 Perl_scan_const
97 Perl_scan_formline
98 Perl_scan_heredoc
99 Perl_scan_ident
100 Perl_scan_inputsymbol
101 Perl_scan_pat
102 Perl_scan_prefix
103 Perl_scan_str
104 Perl_scan_subst
105 Perl_scan_trans
106 Perl_scan_word
107 Perl_setenv_getix
108 Perl_skipspace
109 Perl_sublex_done
110 Perl_sublex_start
111 Perl_sv_peek
112 Perl_sv_ref
113 Perl_sv_setptrobj
114 Perl_timesbuf
115 Perl_too_few_arguments
116 Perl_too_many_arguments
117 Perl_unlnk
118 Perl_wait4pid
119 Perl_watch
120 Perl_yyname
121 Perl_yyrule
122 allgvs
123 curblock
124 curcsv
125 lastretstr
126 mystack_mark
127 perl_init_ext
128 perl_requirepv
129 stack
130 statusvalue_vms
131 Perl_safexcalloc
132 Perl_safexmalloc
133 Perl_safexfree
134 Perl_safexrealloc
135 Perl_my_memcmp
136 Perl_my_memset
137 Perl_cshlen
138 Perl_cshname
139 !END!OF!SKIP!
140
141 # All symbols have a Perl_ prefix because that's what embed.h
142 # sticks in front of them.
143
144
145 print "LIBRARY Perl\n";
146 print "DESCRIPTION 'Perl interpreter, export autogenerated'\n";
147 print "CODE LOADONCALL\n";
148 print "DATA LOADONCALL NONSHARED MULTIPLE\n";
149 print "EXPORTS\n";
150
151 open (GLOBAL, "<../global.sym") || die "failed to open global.sym" . $!;
152 while (<GLOBAL>) {
153         my $symbol;
154         next if (!/^[A-Za-z]/);
155         next if (/_amg[ \t]*$/);
156         $symbol = "Perl_$_";
157         next if ($skip_sym =~ m/$symbol/m);
158         emit_symbol($symbol);
159 }
160 close(GLOBAL);
161
162 # also add symbols from interp.sym
163 # They are only needed if -DMULTIPLICITY is not set but it
164 # doesn't hurt to include them anyway.
165 # these don't have Perl prefix
166
167 open (INTERP, "<../interp.sym") || die "failed to open interp.sym" . $!;
168 while (<INTERP>) {
169         my $symbol;
170         next if (!/^[A-Za-z]/);
171         next if (/_amg[ \t]*$/);
172         $symbol = $_;
173         next if ($skip_sym =~ m/$symbol/m);
174         #print "\t$symbol";
175         emit_symbol("Perl_" . $symbol);
176 }
177
178 #close(INTERP);
179
180 while (<DATA>) {
181         my $symbol;
182         next if (!/^[A-Za-z]/);
183         next if (/^#/);
184         $symbol = $_;
185         next if ($skip_sym =~ m/^$symbol/m);
186         emit_symbol($symbol);
187 }
188
189 sub emit_symbol {
190         my $symbol = shift;
191         chomp $symbol;
192         if ($CCTYPE eq "BORLAND") {
193                 # workaround Borland quirk by exporting both the straight
194                 # name and a name with leading underscore.  Note the
195                 # alias *must* come after the symbol itself, if both
196                 # are to be exported. (Linker bug?)
197                 print "\t_$symbol\n";
198                 print "\t$symbol = _$symbol\n";
199         }
200         else {
201                 # for binary coexistence, export both the symbol and
202                 # alias with leading underscore
203                 print "\t$symbol\n";
204                 print "\t_$symbol = $symbol\n";
205         }
206 }
207
208 1;
209 __DATA__
210 # extra globals not included above.
211 perl_init_i18nl10n
212 perl_init_ext
213 perl_alloc
214 perl_construct
215 perl_destruct
216 perl_free
217 perl_parse
218 perl_run
219 perl_get_sv
220 perl_get_av
221 perl_get_hv
222 perl_get_cv
223 perl_call_argv
224 perl_call_pv
225 perl_call_method
226 perl_call_sv
227 perl_require_pv
228 perl_eval_pv
229 perl_eval_sv
230 boot_DynaLoader
231 win32_errno
232 win32_environ
233 win32_stdin
234 win32_stdout
235 win32_stderr
236 win32_ferror
237 win32_feof
238 win32_strerror
239 win32_fprintf
240 win32_printf
241 win32_vfprintf
242 win32_vprintf
243 win32_fread
244 win32_fwrite
245 win32_fopen
246 win32_fdopen
247 win32_freopen
248 win32_fclose
249 win32_fputs
250 win32_fputc
251 win32_ungetc
252 win32_getc
253 win32_fileno
254 win32_clearerr
255 win32_fflush
256 win32_ftell
257 win32_fseek
258 win32_fgetpos
259 win32_fsetpos
260 win32_rewind
261 win32_tmpfile
262 win32_abort
263 win32_fstat
264 win32_stat
265 win32_pipe
266 win32_popen
267 win32_pclose
268 win32_setmode
269 win32_lseek
270 win32_tell
271 win32_dup
272 win32_dup2
273 win32_open
274 win32_close
275 win32_eof
276 win32_read
277 win32_write
278 win32_spawnvp
279 win32_mkdir
280 win32_rmdir
281 win32_chdir
282 win32_flock
283 win32_execvp
284 win32_htons
285 win32_ntohs
286 win32_htonl
287 win32_ntohl
288 win32_inet_addr
289 win32_inet_ntoa
290 win32_socket
291 win32_bind
292 win32_listen
293 win32_accept
294 win32_connect
295 win32_send
296 win32_sendto
297 win32_recv
298 win32_recvfrom
299 win32_shutdown
300 win32_ioctlsocket
301 win32_setsockopt
302 win32_getsockopt
303 win32_getpeername
304 win32_getsockname
305 win32_gethostname
306 win32_gethostbyname
307 win32_gethostbyaddr
308 win32_getprotobyname
309 win32_getprotobynumber
310 win32_getservbyname
311 win32_getservbyport
312 win32_select
313 win32_endhostent
314 win32_endnetent
315 win32_endprotoent
316 win32_endservent
317 win32_getnetent
318 win32_getnetbyname
319 win32_getnetbyaddr
320 win32_getprotoent
321 win32_getservent
322 win32_sethostent
323 win32_setnetent
324 win32_setprotoent
325 win32_setservent
326 win32_getenv
327 win32_perror
328 win32_setbuf
329 win32_setvbuf
330 win32_flushall
331 win32_fcloseall
332 win32_fgets
333 win32_gets
334 win32_fgetc
335 win32_putc
336 win32_puts
337 win32_getchar
338 win32_putchar
339 win32_malloc
340 win32_calloc
341 win32_realloc
342 win32_free
343 win32stdio
344 Perl_win32_init
345 RunPerl
346 SetIOSubSystem
347 GetIOSubSystem