```{index} single: FFI::Build::Platform ``` # FFI::Build::Platform Platform specific configuration. ## VERSION version 2.12 ## SYNOPSIS ```perl use FFI::Build::Platform; ``` ## DESCRIPTION This class is used to abstract out the platform specific parts of the [FFI::Build](../Build.md) system. You shouldn't need to use it directly in most cases, unless you are working on [FFI::Build](../Build.md) itself. ## CONSTRUCTOR ### new ```perl my $platform = FFI::Build::Platform->new; ``` Create a new instance of [FFI::Build::Platform](Platform.md). ### default ```perl my $platform = FFI::Build::Platform->default; ``` Returns the default instance of [FFI::Build::Platform](Platform.md). ## METHODS 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. ### osname ```perl my $osname = $platform->osname; ``` The "os name" as understood by Perl. This is the same as `$^O`. ### object\_suffix ```perl my $suffix = $platform->object_suffix; ``` The object suffix for the platform. On UNIX this is usually `.o`. On Windows this is usually `.obj`. ### library\_suffix ```perl my(@suffix) = $platform->library_suffix; my $suffix = $platform->library_suffix; ``` The library suffix for the platform. 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 ```perl my $prefix = $platform->library_prefix; ``` The library prefix for the platform. On Unix this is usually `lib`, as in `libfoo`. ### cc ```perl my @cc = @{ $platform->cc }; ``` The C compiler ### cpp ```perl my @cpp = @{ $platform->cpp }; ``` The C pre-processor ### cxx ```perl my @cxx = @{ $platform->cxx }; ``` The C++ compiler that naturally goes with the C compiler. ### cxxld ```perl my @cxxld = @{ $platform->cxxld }; ``` The C++ linker that naturally goes with the C compiler. ### for ```perl my @for = @{ $platform->for }; ``` The Fortran compiler that naturally goes with the C compiler. ### ld ```perl my $ld = $platform->ld; ``` The C linker ### shellwords ```perl my @words = $platform->shellwords(@strings); ``` This is a wrapper around [Text::ParseWords](../../Text/ParseWords.md)'s `shellwords` with some platform workarounds applied. ### ccflags ```perl 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 is usually includes `-fPIC`. ### ldflags ```perl my @ldflags = @{ $platform->ldflags }; ``` The linker flags needed to link object files into a dynamic library. 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`. ### cc\_mm\_works ```perl my $bool = $platform->cc_mm_works; ``` Returns the flags that can be passed into the C compiler to compute dependencies. ### flag\_object\_output ```perl 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 ```perl 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 ```perl 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. ### flag\_export ```perl my @flags = $platform->flag_export(@symbols); ``` Returns the flags that the linker recognizes for exporting functions. ### which ```perl my $path = $platform->which($command); ``` Returns the full path of the given command, if it is available, otherwise `undef` is returned. ### run ```perl $platform->run(@command); ``` ### diag Diagnostic for the platform as a string. This is for human consumption only, and the format may and will change over time so do not attempt to use is programmatically. ## AUTHOR Author: Graham Ollis 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) ## COPYRIGHT AND LICENSE 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.