Commit | Line | Data |
68dc0745 |
1 | If you read this file _as_is_, just ignore the funny characters you |
2 | see. It is written in the POD format (see pod/perlpod.pod) which is |
3 | specially designed to be readable as is. |
4 | |
5 | =head1 NAME |
6 | |
5aabfad6 |
7 | perlwin32 - Perl under Win32 |
68dc0745 |
8 | |
9 | =head1 SYNOPSIS |
10 | |
7bac28a0 |
11 | These are instructions for building Perl under Windows NT (versions |
3e3baf6d |
12 | 3.51 or 4.0), using Visual C++ (versions 2.0 through 5.0) or Borland |
13 | C++ (version 5.x). Currently, this port may also build under Windows95, |
14 | but you can expect problems stemming from the unmentionable command |
15 | shell that infests that platform. Note this caveat is only about |
16 | B<building> perl. Once built, you should be able to B<use> it on |
17 | either Win32 platform (modulo the problems arising from the inferior |
18 | command shell). |
68dc0745 |
19 | |
20 | =head1 DESCRIPTION |
21 | |
3fe9a6f1 |
22 | Before you start, you should glance through the README file |
68dc0745 |
23 | found in the top-level directory where the Perl distribution |
24 | was extracted. Make sure you read and understand the terms under |
25 | which this software is being distributed. |
26 | |
3fe9a6f1 |
27 | Also make sure you read the L<BUGS AND CAVEATS> section below for the |
68dc0745 |
28 | known limitations of this port. |
29 | |
30 | The INSTALL file in the perl top-level has much information that is |
31 | only relevant to people building Perl on Unix-like systems. In |
32 | particular, you can safely ignore any information that talks about |
33 | "Configure". |
34 | |
7bac28a0 |
35 | You may also want to look at two other options for building |
36 | a perl that will work on Windows NT: the README.cygwin32 and |
3e3baf6d |
37 | README.os2 files, which each give a different set of rules to build |
38 | a Perl that will work on Win32 platforms. Those two methods will |
7bac28a0 |
39 | probably enable you to build a more Unix-compatible perl, but you |
40 | will also need to download and use various other build-time and |
41 | run-time support software described in those files. |
68dc0745 |
42 | |
43 | This set of instructions is meant to describe a so-called "native" |
44 | port of Perl to Win32 platforms. The resulting Perl requires no |
45 | additional software to run (other than what came with your operating |
3e3baf6d |
46 | system). Currently, this port is capable of using either the |
47 | Microsoft Visual C++ compiler, or the Borland C++ compiler. The |
48 | ultimate goal is to support the other major compilers that can |
49 | generally be used to build Win32 applications. |
5aabfad6 |
50 | |
51 | This port currently supports MakeMaker (the set of modules that |
52 | is used to build extensions to perl). Therefore, you should be |
53 | able to build and install most extensions found in the CPAN sites. |
c90c0ff4 |
54 | See L<Usage Hints> below for general hints about this. |
68dc0745 |
55 | |
56 | =head2 Setting Up |
57 | |
58 | =over 4 |
59 | |
3e3baf6d |
60 | =item Command Shell |
68dc0745 |
61 | |
62 | Use the default "cmd" shell that comes with NT. In particular, do |
63 | *not* use the 4DOS/NT shell. The Makefile has commands that are not |
c90c0ff4 |
64 | compatible with that shell. The Makefile also has known |
65 | incompatibilites with the default shell that comes with Windows95, |
66 | so building under Windows95 should be considered "unsupported". |
68dc0745 |
67 | |
3e3baf6d |
68 | =item Borland C++ |
69 | |
70 | If you are using the Borland compiler, you will need dmake, a freely |
71 | available make that has very nice macro features and parallelability. |
72 | (The make that Borland supplies is seriously crippled, and will not |
73 | work for MakeMaker builds--if you *have* to bug someone about this, |
74 | I suggest you bug Borland to fix their make :) |
75 | |
76 | A port of dmake for win32 platforms is available from |
77 | "http://www-personal.umich.edu/~gsar/dmake-4.0-win32.tar.gz". |
78 | Fetch and install dmake somewhere on your path. Also make sure you |
79 | copy the Borland dmake.ini file to some location where you keep |
80 | *.ini files. If you use the binary that comes with the above port, you |
81 | will need to set INIT in your environment to the directory where you |
82 | put the dmake.ini file. |
83 | |
84 | =item Microsoft Visual C++ |
68dc0745 |
85 | |
3e3baf6d |
86 | The NMAKE that comes with Visual C++ will suffice for building. |
7bac28a0 |
87 | If you did not choose to always initialize the Visual C++ compilation |
88 | environment variables when you installed Visual C++ on your system, you |
89 | will need to run the VCVARS32.BAT file usually found somewhere like |
90 | C:\MSDEV4.2\BIN. This will set your build environment. |
68dc0745 |
91 | |
3e3baf6d |
92 | You can also use dmake to build using Visual C++, provided: you |
93 | copied the dmake.ini for Visual C++; set INIT to point to the |
94 | directory where you put it, as above; and edit win32/config.vc |
95 | and change "make=nmake" to "make=dmake". The last step is only |
96 | essential if you want to use dmake to be your default make for |
97 | building extensions using MakeMaker. |
98 | |
99 | =item Permissions |
68dc0745 |
100 | |
101 | Depending on how you extracted the distribution, you have to make sure |
7bac28a0 |
102 | some of the files are writable by you. The easiest way to make sure of |
68dc0745 |
103 | this is to execute: |
104 | |
105 | attrib -R *.* /S |
106 | |
107 | from the perl toplevel directory. You don't I<have> to do this if you |
108 | used the right tools to extract the files in the standard distribution, |
109 | but it doesn't hurt to do so. |
110 | |
111 | =back |
112 | |
137443ea |
113 | =head2 Building |
68dc0745 |
114 | |
115 | =over 4 |
116 | |
117 | =item * |
118 | |
68dc0745 |
119 | Make sure you are in the "win32" subdirectory under the perl toplevel. |
137443ea |
120 | This directory contains a "Makefile" that will work with |
3e3baf6d |
121 | versions of NMAKE that come with Visual C++ ver. 2.0 and above, and |
122 | a dmake "makefile.mk" that will work for both Borland and Visual C++ |
123 | builds. The defaults in the dmake makefile are setup to build using the |
124 | Borland compiler. |
68dc0745 |
125 | |
126 | =item * |
127 | |
3e3baf6d |
128 | Edit the Makefile (or makefile.mk, if using dmake) and change the values |
129 | of INST_DRV and INST_TOP if you want perl to be installed in a location |
130 | other than "C:\PERL". If you are using Visual C++ ver. 2.0, uncomment |
131 | the line that sets "CCTYPE=MSVC20". |
c90c0ff4 |
132 | |
3e3baf6d |
133 | You will also have to make sure CCHOME points to wherever you installed |
134 | your compiler. |
c90c0ff4 |
135 | |
68dc0745 |
136 | =item * |
137 | |
3e3baf6d |
138 | Type "nmake" (or "dmake" if you are using that make). |
68dc0745 |
139 | |
137443ea |
140 | This should build everything. Specifically, it will create perl.exe, |
141 | perl.dll, and perlglob.exe at the perl toplevel, and various other |
7bac28a0 |
142 | extension dll's under the lib\auto directory. If the build fails for |
137443ea |
143 | any reason, make sure you have done the previous steps correctly. |
68dc0745 |
144 | |
3e3baf6d |
145 | When building using Visual C++, a perl95.exe will also get built. This |
146 | executable is only needed on Windows95, and should be used instead of |
147 | perl.exe, and then only if you want sockets to work properly on Windows95. |
148 | This is necessitated by a bug in the Microsoft C Runtime that cannot be |
149 | worked around in the "normal" perl.exe. Again, if this bugs you, please |
150 | bug Microsoft :). perl95.exe gets built with its own private copy of the |
151 | C Runtime that is not accessible to extensions (which see the DLL version |
152 | of the CRT). Be aware, therefore, that this perl95.exe will have |
153 | esoteric problems with extensions like perl/Tk that themselves use the C |
154 | Runtime heavily, or want to free() pointers malloc()-ed by perl. |
155 | |
156 | You can avoid the perl95.exe problems completely if you use Borland |
157 | C++ for building perl (perl95.exe is not needed and will not be built |
158 | in that case). |
159 | |
68dc0745 |
160 | =back |
161 | |
162 | =head2 Testing |
163 | |
3e3baf6d |
164 | Type "nmake test" (or "dmake test"). This will run most of the tests from |
165 | the testsuite (many tests will be skipped, and but no test should fail). |
68dc0745 |
166 | |
8b88ae92 |
167 | If some tests do fail, it may be because you are using a different command |
137443ea |
168 | shell than the native "cmd.exe". |
68dc0745 |
169 | |
3e3baf6d |
170 | If you used the Borland compiler, you may see a failure in op/taint.t |
171 | arising from the inability to find the Borland Runtime DLLs on the system |
172 | default path. You will need to copy the DLLs reported by the messages |
173 | from where Borland chose to install it, into the Windows system directory |
174 | (usually somewhere like C:\WINNT\SYSTEM32), and rerun the test. |
175 | |
176 | Please report any other failures as described under L<BUGS AND CAVEATS>. |
68dc0745 |
177 | |
137443ea |
178 | =head2 Installation |
179 | |
3e3baf6d |
180 | Type "nmake install" (or "dmake install"). This will put the newly |
181 | built perl and the libraries under "C:\perl" (actually whatever you set |
182 | C<INST_TOP> to in the Makefile). It will also install the pod |
183 | documentation under C<$INST_TOP\lib\pod> and HTML versions of the same |
184 | under C<$INST_TOP\lib\pod\html>. To use the Perl you just installed, |
185 | set your PATH environment variable to "C:\perl\bin" (or C<$INST_TOP\bin>, |
186 | if you changed the default as above). |
137443ea |
187 | |
7bac28a0 |
188 | =head2 Usage Hints |
189 | |
190 | =over 4 |
191 | |
192 | =item Environment Variables |
193 | |
194 | The installation paths that you set during the build get compiled |
195 | into perl, so you don't have to do anything additional to start |
196 | using that perl (except add its location to your PATH variable). |
197 | |
198 | If you put extensions in unusual places, you can set PERL5LIB |
199 | to a list of paths separated by semicolons where you want perl |
200 | to look for libraries. Look for descriptions of other environment |
201 | variables you can set in the perlrun podpage. |
202 | |
203 | Sometime in the future, some of the configuration information |
204 | for perl will be moved into the Windows registry. |
205 | |
3e3baf6d |
206 | =item File Globbing |
207 | |
208 | By default, perl spawns an external program to do file globbing. |
209 | The install process installs both a perlglob.exe and a perlglob.bat |
210 | that perl can use for this purpose. Note that with the default |
211 | installation, perlglob.exe will be found by the system before |
212 | perlglob.bat. |
213 | |
214 | perlglob.exe relies on the argv expansion done by the C Runtime of |
215 | the particular compiler you used, and therefore behaves very |
216 | differently depending on the Runtime used to build it. To preserve |
217 | compatiblity, perlglob.bat (a perl script/module that can be |
218 | used portably) is installed. Besides being portable, perlglob.bat |
219 | also offers enhanced globbing functionality. |
220 | |
221 | If you want perl to use perlglob.bat instead of perlglob.exe, just |
222 | delete perlglob.exe from the install location (or move it somewhere |
223 | perl cannot find). Using File::DosGlob.pm (which is the same |
224 | as perlglob.bat) to override the internal CORE::glob() works about 10 |
225 | times faster than spawing perlglob.exe, and you should take this |
226 | approach when writing new modules. See File::DosGlob for details. |
227 | |
7bac28a0 |
228 | =item Using perl from the command line |
229 | |
230 | If you are accustomed to using perl from various command-line |
231 | shells found in UNIX environments, you will be less than pleased |
232 | with what Windows NT offers by way of a command shell. |
233 | |
234 | The crucial thing to understand about the "cmd" shell (which is |
235 | the default on Windows NT) is that it does not do any wildcard |
236 | expansions of command-line arguments (so wildcards need not be |
237 | quoted). It also provides only rudimentary quoting. The only |
238 | (useful) quote character is the double quote ("). It can be used to |
239 | protect spaces in arguments and other special characters. The |
240 | Windows NT documentation has almost no description of how the |
241 | quoting rules are implemented, but here are some general observations |
242 | based on experiments: The shell breaks arguments at spaces and |
243 | passes them to programs in argc/argv. Doublequotes can be used |
244 | to prevent arguments with spaces in them from being split up. |
245 | You can put a double quote in an argument by escaping it with |
246 | a backslash and enclosing the whole argument within double quotes. |
247 | The backslash and the pair of double quotes surrounding the |
248 | argument will be stripped by the shell. |
249 | |
250 | The file redirection characters "<", ">", and "|" cannot be quoted |
251 | by double quotes (there are probably more such). Single quotes |
252 | will protect those three file redirection characters, but the |
253 | single quotes don't get stripped by the shell (just to make this |
254 | type of quoting completely useless). The caret "^" has also |
255 | been observed to behave as a quoting character (and doesn't get |
256 | stripped by the shell also). |
257 | |
258 | Here are some examples of usage of the "cmd" shell: |
259 | |
260 | This prints two doublequotes: |
261 | |
262 | perl -e "print '\"\"' " |
263 | |
264 | This does the same: |
265 | |
266 | perl -e "print \"\\\"\\\"\" " |
267 | |
268 | This prints "bar" and writes "foo" to the file "blurch": |
269 | |
270 | perl -e "print 'foo'; print STDERR 'bar'" > blurch |
271 | |
272 | This prints "foo" ("bar" disappears into nowhereland): |
273 | |
274 | perl -e "print 'foo'; print STDERR 'bar'" 2> nul |
275 | |
276 | This prints "bar" and writes "foo" into the file "blurch": |
277 | |
278 | perl -e "print 'foo'; print STDERR 'bar'" 1> blurch |
279 | |
7bac28a0 |
280 | This pipes "foo" to the "less" pager and prints "bar" on the console: |
281 | |
282 | perl -e "print 'foo'; print STDERR 'bar'" | less |
283 | |
284 | This pipes "foo\nbar\n" to the less pager: |
285 | |
7bac28a0 |
286 | perl -le "print 'foo'; print STDERR 'bar'" 2>&1 | less |
287 | |
288 | This pipes "foo" to the pager and writes "bar" in the file "blurch": |
289 | |
290 | perl -e "print 'foo'; print STDERR 'bar'" 2> blurch | less |
291 | |
292 | |
c90c0ff4 |
293 | Discovering the usage of the "command.com" shell on Windows95 |
7bac28a0 |
294 | is left as an exercise to the reader :) |
295 | |
296 | =item Building Extensions |
297 | |
298 | The Comprehensive Perl Archive Network (CPAN) offers a wealth |
299 | of extensions, some of which require a C compiler to build. |
300 | Look in http://www.perl.com/ for more information on CPAN. |
301 | |
302 | Most extensions (whether they require a C compiler or not) can |
303 | be built, tested and installed with the standard mantra: |
304 | |
305 | perl Makefile.PL |
3e3baf6d |
306 | $MAKE |
307 | $MAKE test |
308 | $MAKE install |
7bac28a0 |
309 | |
3e3baf6d |
310 | where $MAKE stands for NMAKE or DMAKE. Some extensions may not |
311 | provide a testsuite (so "$MAKE test" may not do anything, or fail), |
312 | but most serious ones do. |
7bac28a0 |
313 | |
3e3baf6d |
314 | If a module implements XSUBs, you will need one of the supported |
315 | C compilers. You must make sure you have set up the environment for |
316 | the compiler for command-line compilation. |
7bac28a0 |
317 | |
3e3baf6d |
318 | If a module does not build for some reason, look carefully for |
7bac28a0 |
319 | why it failed, and report problems to the module author. If |
320 | it looks like the extension building support is at fault, report |
321 | that with full details of how the build failed using the perlbug |
322 | utility. |
323 | |
c90c0ff4 |
324 | =item Win32 Specific Extensions |
325 | |
326 | A number of extensions specific to the Win32 platform are available |
327 | from CPAN. You may find that many of these extensions are meant to |
328 | be used under the Activeware port of Perl, which used to be the only |
329 | native port for the Win32 platform. Since the Activeware port does not |
330 | have adequate support for Perl's extension building tools, these |
331 | extensions typically do not support those tools either, and therefore |
332 | cannot be built using the generic steps shown in the previous section. |
333 | |
334 | To ensure smooth transitioning of existing code that uses the |
335 | Activeware port, there is a bundle of Win32 extensions that contains |
336 | all of the Activeware extensions and most other Win32 extensions from |
337 | CPAN in source form, along with many added bugfixes, and with MakeMaker |
338 | support. This bundle is available at: |
339 | |
340 | http://www.perl.com/CPAN/authors/id/GSAR/libwin32-0.06.tar.gz |
341 | |
342 | See the README in that distribution for building and installation |
343 | instructions. Look for later versions that may be available at the |
344 | same location. |
345 | |
346 | It is expected that authors of Win32 specific extensions will begin |
347 | distributing their work in MakeMaker compatible form subsequent to |
348 | the 5.004 release of perl, at which point the need for a dedicated |
349 | bundle such as the above should diminish. |
350 | |
7bac28a0 |
351 | =item Miscellaneous Things |
352 | |
353 | A full set of HTML documentation is installed, so you should be |
354 | able to use it if you have a web browser installed on your |
355 | system. |
356 | |
357 | C<perldoc> is also a useful tool for browsing information contained |
358 | in the documentation, especially in conjunction with a pager |
359 | like C<less> (recent versions of which have Win32 support). You may |
360 | have to set the PAGER environment variable to use a specific pager. |
361 | "perldoc -f foo" will print information about the perl operator |
362 | "foo". |
363 | |
364 | If you find bugs in perl, you can run C<perlbug> to create a |
365 | bug report (you may have to send it manually if C<perlbug> cannot |
366 | find a mailer on your system). |
367 | |
368 | =back |
369 | |
68dc0745 |
370 | =head1 BUGS AND CAVEATS |
371 | |
3e3baf6d |
372 | This port should be considered beta quality software at the present |
373 | time because some details are still in flux and there may be |
374 | changes in any of these areas: build process, installation structure, |
375 | supported utilities/modules, and supported perl functionality. |
376 | In particular, functionality specific to the Win32 environment may |
377 | ultimately be supported as either core modules or extensions. This |
378 | means that you should be prepared to recompile extensions when binary |
379 | incompatibilites arise due to changes in the internal structure of |
380 | the code. |
381 | |
382 | The DLLs produced by the two supported compilers are incompatible |
383 | with each other due to the conventions they use to export symbols, |
384 | and due to differences in the Runtime libraries that they provide. |
385 | This means that extension binaries built under either compiler will |
386 | only work with the perl binaries built under the same compiler. |
387 | If you know of a robust, freely available C Runtime that can |
388 | be used under win32, let us know. |
68dc0745 |
389 | |
8b88ae92 |
390 | If you have had prior exposure to Perl on Unix platforms, you will notice |
391 | this port exhibits behavior different from what is documented. Most of the |
7bac28a0 |
392 | differences fall under one of these categories. We do not consider |
393 | any of them to be serious limitations (especially when compared to the |
394 | limited nature of some of the Win32 OSes themselves :) |
68dc0745 |
395 | |
396 | =over 8 |
397 | |
398 | =item * |
399 | |
400 | C<stat()> and C<lstat()> functions may not behave as documented. They |
401 | may return values that bear no resemblance to those reported on Unix |
7bac28a0 |
402 | platforms, and some fields (like the the one for inode) may be completely |
403 | bogus. |
68dc0745 |
404 | |
405 | =item * |
406 | |
407 | The following functions are currently unavailable: C<fork()>, C<exec()>, |
5aabfad6 |
408 | C<dump()>, C<chown()>, C<link()>, C<symlink()>, C<chroot()>, |
68dc0745 |
409 | C<setpgrp()>, C<getpgrp()>, C<setpriority()>, C<getpriority()>, |
3e3baf6d |
410 | C<syscall()>, C<fcntl()>. This list is possibly very incomplete. |
68dc0745 |
411 | |
412 | =item * |
413 | |
414 | Various C<socket()> related calls are supported, but they may not |
415 | behave as on Unix platforms. |
416 | |
417 | =item * |
418 | |
419 | The four-argument C<select()> call is only supported on sockets. |
420 | |
421 | =item * |
422 | |
5aabfad6 |
423 | C<$?> ends up with the exitstatus of the subprocess (this is different |
424 | from Unix, where the exitstatus is actually given by "$? >> 8"). |
425 | Failure to spawn() the subprocess is indicated by setting $? to |
426 | "255<<8". This is subject to change. |
68dc0745 |
427 | |
428 | =item * |
429 | |
430 | Building modules available on CPAN is mostly supported, but this |
431 | hasn't been tested much yet. Expect strange problems, and be |
432 | prepared to deal with the consequences. |
433 | |
434 | =item * |
435 | |
436 | C<utime()>, C<times()> and process-related functions may not |
437 | behave as described in the documentation, and some of the |
438 | returned values or effects may be bogus. |
439 | |
440 | =item * |
441 | |
3e3baf6d |
442 | Signal handling may not behave as on Unix platforms (where it |
443 | doesn't exactly "behave", either :). |
68dc0745 |
444 | |
445 | =item * |
446 | |
7bac28a0 |
447 | File globbing may not behave as on Unix platforms. In particular, |
3e3baf6d |
448 | if you don't use perlglob.bat for globbing, it will understand |
449 | wildcards only in the filename component (and not in the pathname). |
450 | In other words, something like "print <*/*.pl>" will not print all the |
451 | perl scripts in all the subdirectories one level under the current one |
452 | (like it does on UNIX platforms). perlglob.exe is also dependent on |
453 | the particular implementation of wildcard expansion in the vendor |
454 | libraries used to build it (which varies wildly at the present time). |
455 | Using perlglob.bat (or File::DosGlob) avoids these limitations, but |
456 | still only provides DOS semantics (read "warts") for globbing. |
68dc0745 |
457 | |
458 | =back |
459 | |
460 | Please send detailed descriptions of any problems and solutions that |
461 | you may find to <F<perlbug@perl.com>>, along with the output produced |
462 | by C<perl -V>. |
463 | |
464 | =head1 AUTHORS |
465 | |
466 | =over 4 |
467 | |
3e3baf6d |
468 | Gary Ng E<lt>71564.1743@CompuServe.COME<gt> |
68dc0745 |
469 | |
3e3baf6d |
470 | Gurusamy Sarathy E<lt>gsar@umich.eduE<gt> |
68dc0745 |
471 | |
3e3baf6d |
472 | Nick Ing-Simmons E<lt>nick@ni-s.u-net.comE<gt> |
68dc0745 |
473 | |
474 | =back |
475 | |
476 | =head1 SEE ALSO |
477 | |
478 | L<perl> |
479 | |
480 | =head1 HISTORY |
481 | |
482 | This port was originally contributed by Gary Ng around 5.003_24, |
483 | and borrowed from the Hip Communications port that was available |
484 | at the time. |
485 | |
486 | Nick Ing-Simmons and Gurusamy Sarathy have made numerous and |
487 | sundry hacks since then. |
488 | |
3e3baf6d |
489 | Borland support was added in 5.004_01 (Gurusamy Sarathy). |
490 | |
491 | Last updated: 11 June 1997 |
68dc0745 |
492 | |
493 | =cut |
3e3baf6d |
494 | |