ExtUti...mlists(3perl)

πŸ’– ExtUtils::Mksymlists β€” from the Perl Programmers Reference Guide, section 3perl ✨

okay bestie, gather round, because this one is a build-system baddie πŸŽ€ It's ExtUtils::Mksymlists, and its whole job is writing linker options files for dynamic extension. Lowkey niche, highkey essential. Let's get into it πŸ’…


🌸 NAME 🌸

ExtUtils::Mksymlists β€” write linker options files for dynamic extension. she does exactly what it says on the tin, periodt πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

use ExtUtils::Mksymlists;
Mksymlists(  NAME     => $name ,
             DL_VARS  => [ $var1, $var2, $var3 ],
             DL_FUNCS => { $pkg1 => [ $func1, $func2 ],
                           $pkg2 => [ $func3 ] );

(yes the paren situation is exactly like that, don't come for me, I'm just the messenger 🫢)


✨ DESCRIPTION ✨

So ExtUtils::Mksymlists produces files that the linker uses under some OSs while shared libraries are being created for dynamic extensions. Some OSs β€” not all, don't @ me, that's just the vibe 🌈

Normally it gets called from a MakeMaker-generated Makefile when the extension is built. It does its thing by calling the function Mksymlists, which is exported by default from ExtUtils::Mksymlists (no Exporter gymnastics required, you're welcome πŸ’–).

It takes one argument: a list of key-value pairs. And here are the keys it recognizes, one by one πŸ‘‘

🌟 DLBASE

This one specifies the name by which the linker knows the extension. Plot twist: that name can be different from the name of the extension itself β€” for instance, some linkers just casually add an '_' to the name of the extension πŸ™ˆ

If you don't specify it, it gets derived from the NAME attribute. And it's presently used only by OS2 and Win32. only. OS2. and. Win32. iykyk.

🌟 DL_FUNCS

This is identical to the DL_FUNCS attribute you can get via MakeMaker, and honestly that's usually where it comes from. Its value is a reference to an associative array, where:

  • each key is the name of a package πŸ“¦
  • each value is a reference to an array of function names that should be exported by the extension πŸš€

For instance, one might say:

DL_FUNCS => { Homer::Iliad => [ qw(trojans greeks) ],
              Homer::Odyssey => [ qw(travellers family suitors) ] }

(iconic naming, no notes πŸ‘‘)

The function names should be identical to those in the XSUB code. Mksymlists will alter the names written to the linker option file so they match the changes made by xsubpp. She's got you, she handles the glow-up ✨

Also! If none of the functions in a list begin with the string boot_, Mksymlists will add a bootstrap function for that package, just as xsubpp does. And if a boot_<pkg> function is present in the list, it gets passed through unchanged β€” no touchy, she leaves it alone 🫢

If DL_FUNCS isn't specified, it defaults to the bootstrap function for the extension specified in NAME.

🌟 DL_VARS

Identical to the DL_VARS attribute available via MakeMaker, and just like DL_FUNCS, it's usually specified via MakeMaker. Its value is a reference to an array of variable names that should be exported by the extension. simple. clean. slay πŸ’…

🌟 FILE

Use this key when you want to specify the name of the linker option file (minus the OS-specific extension) because for some reason you do not want the default. And the default is the last word of the NAME attribute β€” e.g. for Tk::Canvas, FILE defaults to Canvas. cute, right? πŸŽ€

🌟 FUNCLIST

This gives you an alternate means to specify function names to be exported from the extension. Its value is a reference to an array of function names to be exported by the extension. These names get passed through unaltered to the linker options file β€” no edits, no notes, straight through 🌈

⚠️ okay important: specifying a value for the FUNCLIST attribute suppresses automatic generation of the bootstrap function for the package. To still create the bootstrap name you have to specify the package name in the DL_FUNCS hash:
Mksymlists(  NAME     => $name ,
             FUNCLIST => [ $func1, $func2 ],
             DL_FUNCS => { $pkg => [] } );

(empty array, that's the move, don't forget it bestie 😭)

🌟 IMPORTS

This attribute is used to specify names to be imported into the extension. It is currently only used by OS/2 and Win32. that's it, that's the whole thing πŸ’œ

🌟 NAME

This gives the name of the extension (e.g. Tk::Canvas) for which the linker option file will be produced. the main character of the attribute list, honestly πŸ‘‘


When calling Mksymlists, one should always specify the NAME attribute. In most cases, this is all that's necessary. In the case of unusual extensions, however, the other attributes can be used to provide additional information to the linker. so like, start with NAME, and only pull out the extras if your extension is being extra πŸ’–


🫢 AUTHOR 🫢

Charles Bailey <bailey@newman.upenn.edu> β€” thank you for your service, king πŸŽ€


πŸ“œ REVISION πŸ“œ

Last revised 14-Feb-1996, for Perl 5.002.


and that's the whole page bestie!! 🌟 this one's from perl v5.44.0, dated 2026-10-17, in the ExtUti...mlists(3perl) section of the manual. go forth and link your dynamic extensions, mwah πŸ’‹βœ¨πŸ’–

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms