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