FFI::B...atform(3pm)

πŸ¦‹ FFI::Build::Platform β€” platform specific configuration πŸ’…

okay so this is the FFI::B...atform(3pm) page bestie, and it's honestly giving "backstage pass to the FFI::Build machine" energy. Welcome πŸŽ€


✨ NAME ✨

FFI::Build::Platform β€” literally just the platform-specific configuration bits. that's the whole vibe πŸ’…

🌸 VERSION 🌸

version 2.11 ⭐

πŸ¦‹ SYNOPSIS πŸ¦‹

use FFI::Build::Platform;

that's it. that's the whole synopsis. she's lowkey minimal and I respect it 🫢


πŸ’œ DESCRIPTION πŸ’œ

okay so picture this: this class exists to abstract out all the platform specific parts of the FFI::Build system. like, all the "oh no every OS does this differently" mess gets hidden in here ✨

and ngl? you probably don't need to touch it directly in most cases. the only people who genuinely need to be in here are the ones working on FFI::Build itself. it's giving "staff only" door, iykyk πŸ™ˆ


🧚 CONSTRUCTOR 🧚

πŸ’– new

my $platform = FFI::Build::Platform->new;

creates a brand new instance of FFI::Build::Platform. fresh out the box, main character energy πŸ‘‘

⭐ default

my $platform = FFI::Build::Platform->default;

returns the default instance of FFI::Build::Platform. like, the one that's already chilling there waiting for you 🫢


πŸ”₯ METHODS πŸ”₯

okay so listen β€” all of these methods may be called either as instance or classes methods. If called as a class method, the default instance will be used. that's the rule, no cap πŸ’€

πŸ“ osname

my $osname = $platform->osname;

the "os name" as understood by Perl. this is the same as $^O. iconic, honestly πŸŽ€

πŸ¦‹ object_suffix

my $suffix = $platform->object_suffix;

the object suffix for the platform. on UNIX this is usually .o. on Windows this is usually .obj. bestie they really said "let's be different for no reason" 😭

πŸ’… library_suffix

my(@suffix) = $platform->library_suffix;
my $suffix  = $platform->library_suffix;

the library suffix for the platform β€” and yes she can give you a list or a scalar, she contains multitudes ✨

  • on Linux and some other UNIX this is often .so
  • on OS X, this is .dylib and .bundle
  • on Windows this is .dll

🌈 library_prefix

my $prefix = $platform->library_prefix;

the library prefix for the platform. on Unix this is usually lib, as in libfoo. so foo walks in and leaves as libfoo. a glow-up fr fr πŸ’–

πŸ”₯ cc

my @cc = @{ $platform->cc };

the C compiler πŸ”₯ (note she's an arrayref, so deref her before you @ her)

🌸 cpp

my @cpp = @{ $platform->cpp };

the C pre-processor 🌸

πŸ‘‘ cxx

my @cxx = @{ $platform->cxx };

the C++ compiler that naturally goes with the C compiler. they're a matched set, a duo, a package deal 🫢

⭐ cxxld

my @cxxld = @{ $platform->cxxld };

the C++ linker that naturally goes with the C compiler. same bestie-energy as above, just the linker edition πŸŽ€

πŸ’€ for

my @for = @{ $platform->for };

the Fortran compiler that naturally goes with the C compiler. yes the method is literally named for. yes that's confusing. no I don't make the rules 😭

🧚 ld

my $ld = $platform->ld;

the C linker. that's it. she's short and she knows it πŸ’…

πŸŽ€ shellwords

my @words = $platform->shellwords(@strings);

this is a wrapper around Text::ParseWords's shellwords with some platform workarounds applied. so it's the vibe you know, just with extra ✨platform seasoning✨

πŸ’œ ccflags

my @ccflags = @{ $platform->cflags};

the compiler flags, including those needed to compile object files that can be linked into a dynamic library. on Linux, for example, this usually includes -fPIC. (also yes, the method is ccflags and the accessor inside is cflags β€” she's quirky like that, don't @ her πŸ™ˆ)

🌈 ldflags

my @ldflags = @{ $platform->ldflags };

the linker flags needed to link object files into a dynamic library. and bestie, listen carefully: this is NOT the "libs" style library flags that specify the location and name of a library to link against. this is instead the flags that tell the linker to generate a dynamic library. on Linux, for example, this is usually -shared. don't mix them up, I'm begging 🫢

πŸ¦‹ cc_mm_works

my $bool = $platform->cc_mm_works;

returns the flags that can be passed into the C compiler to compute dependencies πŸ‘€ (yes, the name says $bool and the description says flags β€” that's what the original says, so that's what you get, no notes πŸ’€)

🌸 flag_object_output

my @flags = $platform->flag_object_output($object_filename);

returns the flags that the compiler recognizes as being used to write out to a specific object filename ✨

πŸ’– flag_library_output

my @flags = $platform->flag_library_output($library_filename);

returns the flags that the compiler recognizes as being used to write out to a specific library filename 🌸

πŸ”₯ flag_exe_output

my @flags = $platform->flag_exe_output($library_filename);

returns the flags that the compiler recognizes as being used to write out to a specific exe filename. (and yeah, the example variable is literally $library_filename even though we're talking about an exe β€” that's just how she is, copy it exactly πŸ‘‘)

⭐ flag_export

my @flags = $platform->flag_export(@symbols);

returns the flags that the linker recognizes for exporting functions πŸŽ€

🧚 which

my $path = $platform->which($command);

returns the full path of the given command, if it is available, otherwise undef is returned. so if she's not there, you get undef and a little bit of heartbreak 😭

πŸ’€ run

$platform->run(@command);

runs the thing. that's the whole bit. go off πŸ’…

πŸ“ diag

diagnostic for the platform as a string. and this is for human consumption only β€” the format may and will change over time, so do not attempt to use it programmatically. I'm so serious, don't parse her, she's not for that πŸ™ˆ


🫢 AUTHOR 🫢

Author: Graham Ollis <plicease@cpan.org> πŸ’–

Contributors:

  • Bakkiaraj Murugesan (bakkiaraj)
  • Dylan Cali (calid)
  • pipcet
  • Zaki Mughal (zmughal)
  • Fitz Elliott (felliott)
  • Vickenty Fesunov (vyf)
  • Gregor Herrmann (gregoa)
  • Shlomi Fish (shlomif)
  • Damyan Ivanov
  • Ilya Pavlov (Ilya33)
  • Petr PΓ­saΕ™ (ppisar)
  • Mohammad S Anwar (MANWAR)
  • HΓ₯kon HΓ¦gland (hakonhagland, HAKONH)
  • Meredith (merrilymeredith, MHOWARD)
  • Diab Jerius (DJERIUS)
  • Eric Brine (IKEGAMI)
  • szTheory
  • JosΓ© JoaquΓ­n Atria (JJATRIA)
  • Pete Houston (openstrike, HOUSTON)
  • Lukas Mai (MAUKE)

look at that contributor list, it's giving squad goals πŸ‘‘βœ¨


This software is copyright (c) 2015-2022 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. πŸ’œ


and that's the page babes πŸŽ€ β€” brought to you by perl v5.42.3, dated 2026-08-20, and yes the manual name is literally FFI::B...atform(3pm) because the title got truncated and honestly? she ate anyway πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from