I am not sure how to name this module. I consider its existence a joke. Like Acme::Bleach. PE=Portable Executable, the Win32 exe/dll file format. Should it be in App::? Acme::? or is Win32:: fine? is PEPM fine or should it be PE::PM? There is the "Win32::Exe" and "Win32::PEFile" distros but I share nothing with them except all of them read PE files on a binary level. PEPM is pronounceable as "pep-em". PMPE is more difficult to pronounce as "pum-pe". Anyone disagree? One name could be Win32::PE::Fat as in Fat Binary (but this really isn't a fat binary, unless you call Perl a CPU architecture, and technically it is true that this module creates a DOS executable binary that contains "machine code" for the "Wall CPU" architecture that debuted on 1994-Oct-17), but this still isnt a Fat Binary since the Perl code is not a PP version of the x86/x64 XS machine code in the file, instead the Perl code is the PP side of the XS module.

This module takes a jab at the moribund ".pmc" file format. Its output could be called a .pmc "perl module [with C] compiled [code]".

I've included its WIP POD to give a taste of what it does/name/purpose.

=head1 NAME

Win32::PEPM - turn your XS .dll+.pm into being simultaneously a .pm and .dll

=head1 SYNOPSIS

  #in your Makefile.PL
  use Win32::PEPM::Build;
  my %hash = {
    NAME              => 'Foo::Bar',
    AUTHOR            => 'A. U. Thor <a.u.t...@a.galaxy.far.far.away>',
  ...
  Win32::PEPM::Build::WMHash(\%hash);
  WriteMakefile(%hash;)

  #in your .pm
  use Win32::PEPM;
  Win32::PEPM::load(__FILE__, $VERSION);
  1;
  __END__ #you must have this

=head1 DESCRIPTION

This module is a packager that allows you to build a .pm that is simultaneously
a .pm that can be C<do>, C<require>d, or C<use>d, and the same .pm is a 100%
real DLL containing XS code. The generated file meets the file format standards
of both a .pm and a PE (Portable Executable). The author of this module sees
this module as a joke since with this "packager", the .pm text is stored
uncompressed in the .dll, and there is no sane reason to keep .pm text memory mapped into a process since after parsing/compiling .pm, the .pm text is never referenced again, yet with this "packager", if the XS DLL is loaded, so is the .pm text, into the process. Google says IMAGE_SCN_MEM_DISCARDABLE doesn't work.

The resulting .pm that is built can not be edited even though it mostly looks like plain text. If it is edited, the DLL will be corrupt. The resulting .pm,
although superficially looking like pure perl can not be moved between perl
installations/version, since the XS DLL inside the .pm, like all XS DLLs/SOs is
bound to a particular perl installation.

=head1 FUNCTIONS

=head2 load

    Win32::PEPM::load(__FILE__, $VERSION);

Similar to L<XSLoader|XSLoader's> C<load> sub except takes a filename as first
arg. This file name must be the C<__FILE__> token.

=head1 KNOWN ISSUES

=over 4

=item *

Mingw/GCC support not implemented. Patches welcome. The author has no clue
what VC's C<-stub> is with C<ld>.

=back

=head1 AUTHOR

bulk88, E<lt>bul...@cpan.orge<gt>

Reply via email to