generate executables from Perl programs


SUBMITTED BY: Guest

DATE: June 2, 2014, 1:26 p.m.

FORMAT: Text only

SIZE: 3.0 kB

HITS: 5815

  1. NAME
  2. perlcc - generate executables from Perl programs
  3. SYNOPSIS
  4. $ perlcc hello # Compiles into executable 'a.out'
  5. $ perlcc -o hello hello.pl # Compiles into executable 'hello'
  6. $ perlcc -O file # Compiles using the optimised C backend
  7. $ perlcc -B file # Compiles using the bytecode backend
  8. $ perlcc -c file # Creates a C file, 'file.c'
  9. $ perlcc -S -o hello file # Creates a C file, 'file.c',
  10. # then compiles it to executable 'hello'
  11. $ perlcc -c out.c file # Creates a C file, 'out.c' from 'file'
  12. $ perlcc -e 'print q//' # Compiles a one-liner into 'a.out'
  13. $ perlcc -c -e 'print q//' # Creates a C file 'a.out.c'
  14. $ perlcc -I /foo hello # extra headers (notice the space after -I)
  15. $ perlcc -L /foo hello # extra libraries (notice the space after -L)
  16. $ perlcc -r hello # compiles 'hello' into 'a.out', runs 'a.out'.
  17. $ perlcc -r hello a b c # compiles 'hello' into 'a.out', runs 'a.out'.
  18. # with arguments 'a b c'
  19. $ perlcc hello -log c # compiles 'hello' into 'a.out' logs compile
  20. # log into 'c'.
  21. DESCRIPTION
  22. perlcc creates standalone executables from Perl programs, using the code generators provided by the B module. At present, you may either create executable Perl bytecode, using the "-B" option, or generate and compile C files using the standard and 'optimised' C backends.
  23. The code generated in this way is not guaranteed to work. The whole codegen suite ("perlcc" included) should be considered very experimental. Use for production purposes is strongly discouraged.
  24. OPTIONS
  25. -Llibrary directories
  26. Adds the given directories to the library search path when C code is passed to your C compiler.
  27. -Iinclude directories
  28. Adds the given directories to the include file search path when C code is passed to your C compiler; when using the Perl bytecode option, adds the given directories to Perl's include path.
  29. -o output file name
  30. Specifies the file name for the final compiled executable.
  31. -c C file name
  32. Create C code only; do not compile to a standalone binary.
  33. -e perl code
  34. Compile a one-liner, much the same as "perl -e '...'"
  35. -S
  36. Do not delete generated C code after compilation.
  37. -B
  38. Use the Perl bytecode code generator.
  39. -O
  40. Use the 'optimised' C code generator. This is more experimental than everything else put together, and the code created is not guaranteed to compile in finite time and memory, or indeed, at all.
  41. -v
  42. Increase verbosity of output; can be repeated for more verbose output.
  43. -r
  44. Run the resulting compiled script after compiling it.
  45. -log
  46. Log the output of compiling to a file rather than to stdout.

comments powered by Disqus