Skip to content

DynaLoader.pm on Win32 bake in Config.pm (PERL_BUILD_EXPAND_CONFIG_VARS) #23423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

bulk88
Copy link
Contributor

@bulk88 bulk88 commented Jul 11, 2025

It seems $ENV{PERL_BUILD_EXPAND_CONFIG_VARS} is a long forgotten by POSIX Perl build config option. Apparantly there is a belief that DynaLoader.pm is a dual-life on CPAN, and 30 different versions of stable Perls must share 1 non-arch DynaLoader.pm file on Linux.

On Win32, the $Config{vars} that DynaLoader.pm wants, are not, and make no sense to be end user interp build time configurable. There is no file extension for shlibs except .dll on Win32. No .aout vs .so vs .sl drama.

$Config{libpth} telling DynaLoader to pass a .o/.obj/.a/.lib file to LoadLibraryEx() is out of scope of this commit.

  • Decoding $Config::Config{libpth} into actual paths on Win32 is complicated, $Config::Config{libpth} is 1 or more paths, separated by " " space, if the individual path needs to escape a " " space like "C:\Program Files", the path is wrapped in '"' quotes. So use an outside tool Text::ParseWords to parse the string, since /win32/config_sh.PL's sub mungepath {} created the string inside $Config::Config{libpth} specifically for Text::ParseWords to parse it under Text::ParseWords logic
  • add "length($ldlibpthname) &&" b/c on Win32 $ldlibpthname is empty string
  • to_string($Config{'dlsrc'}), ")\n;" ;<<< looks like a typo for a ; on a line by itself, fix it

  • add binmode(OUT) on Win32 for anti-CRLF inside DynaLoader.pm, less bytes to read and parse off the disk at perl proc startup

  • This set of changes does not require a perldelta entry.

It seems $ENV{PERL_BUILD_EXPAND_CONFIG_VARS} is a long forgotten by
POSIX Perl build config option. Apparantly there is a belief that
DynaLoader.pm is a dual-life on CPAN, and 30 different versions of
stable Perls must share 1 non-arch DynaLoader.pm file on Linux.

On Win32, the $Config{vars} that DynaLoader.pm wants, are not,
and make no sense to be end user interp build time configurable.
There is no file extension for shlibs except .dll on Win32.
No .aout vs .so vs .sl drama.

$Config{libpth} telling DynaLoader to pass a .o/.obj/.a/.lib file to
LoadLibraryEx() is out of scope of this commit.

- Decoding $Config::Config{libpth} into actual paths on Win32 is
  complicated, $Config::Config{libpth} is 1 or more paths, separated by
  " " space, if the individual path needs to escape a " " space like
  "C:\Program Files", the path is wrapped in '"' quotes. So use an outside
  tool Text::ParseWords to parse the string, since /win32/config_sh.PL's
  sub mungepath {} created the string inside $Config::Config{libpth}
  specifically for Text::ParseWords to parse it under Text::ParseWords
  logic
- add "length($ldlibpthname) &&" b/c on Win32 $ldlibpthname is empty string
- >>>to_string($Config{'dlsrc'}), ")\n;" ;<<< looks like a typo for a ;
  on a line by itself, fix it
- add binmode(OUT) on Win32 for anti-CRLF inside DynaLoader.pm, less bytes
  to read and parse off the disk at perl proc startup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant