Loading...
Searching...
No Matches
Functions
Architecture.h File Reference

Provides functions for getting the primary and secondary architectures of the system. More...

Functions

__BEGIN_DECLS const char * get_architecture ()
 Returns the name of the caller's architecture.
 
status_t get_architectures (BStringList &_architectures)
 Returns the names of the system's primary and secondary architectures.
 
size_t get_architectures (const char **architectures, size_t count)
 Returns the names of the system's primary and secondary architectures.
 
const char * get_primary_architecture ()
 Returns the name of the system's primary architecture.
 
__END_DECLS status_t get_secondary_architectures (BStringList &_architectures)
 Returns the names of the system's secondary architectures.
 
size_t get_secondary_architectures (const char **architectures, size_t count)
 Returns the names of the system's secondary architectures.
 
const char * guess_architecture_for_path (const char *path)
 Returns the name of the architecture associated with the given path.
 

Detailed Description

Provides functions for getting the primary and secondary architectures of the system.

Function Documentation

◆ get_architecture()

const char * get_architecture ( )

Returns the name of the caller's architecture.

This is the packaging architecture the caller's code has been built for, which may not be the system's primary architecture.

Returns
The name of the caller's architecture.
See also
get_primary_architecture()
Since
Haiku R1

◆ get_architectures() [1/2]

status_t get_architectures ( BStringList _architectures)

Returns the names of the system's primary and secondary architectures.

This is a C++ interface similar to get_architectures(const char**,size_t). Instead of returning the architecture names in a pre-allocated array, it expects a BStringList. Note that this version can fail when running out of memory.

Parameters
_architecturesReference to a BStringList that will be set to the list of names of primary and secondary architectures. On error the list will be emptied.
Returns
A status code.
Return values
B_OKEverything went fine.
B_NO_MEMORYA memory allocation failed.
See also
get_architectures(const char**,size_t)
Since
Haiku R1

◆ get_architectures() [2/2]

size_t get_architectures ( const char **  architectures,
size_t  count 
)

Returns the names of the system's primary and secondary architectures.

This is a convenience function that returns both the primary architecture as returned by get_primary_architecture() and the secondary architectures as returned by get_secondary_architectures() in the provided array.

Parameters
architecturesA pre-allocated array of size count where the names of the architectures will be stored. Can be NULL if count is 0.
countThe size of the architectures array.
Returns
The actual number of architectures. May be greater than count, but at most count names will be written to architectures.

◆ get_primary_architecture()

const char * get_primary_architecture ( )

Returns the name of the system's primary architecture.

This is the packaging architecture the main system has been built for.

Returns
The name of the system's primary architecture.
Since
Haiku R1

◆ get_secondary_architectures() [1/2]

status_t get_secondary_architectures ( BStringList _architectures)

Returns the names of the system's secondary architectures.

This is a C++ interface similar to get_secondary_architectures(const char**,size_t). Instead of returning the architecture names in a pre-allocated array, it expects a BStringList. Note that this version can fail when running out of memory.

Parameters
_architecturesReference to a BStringList that will be set to the list of names of secondary architectures. On error the list will be emptied.
Returns
A status code.
Return values
B_OKEverything went fine.
B_NO_MEMORYA memory allocation failed.
See also
get_secondary_architectures(const char**,size_t)
Since
Haiku R1

◆ get_secondary_architectures() [2/2]

size_t get_secondary_architectures ( const char **  architectures,
size_t  count 
)

Returns the names of the system's secondary architectures.

These are the packaging architectures the system does provide additional support for (i.e. not including the primary architecture). Only actually installed support is considered. E.g. on a pure x86 gcc 2 system (primary architecture "x86_gcc2") without any support installed for gcc 4 executables, the function will not return any secondary architectures, even if it would be possible to install the support for gcc 4.

Parameters
architecturesA pre-allocated array of size count where the names of the secondary architectures will be stored. Can be NULL, if count is 0.
countThe size of the architectures array.
Returns
The actual number of secondary architectures. May be greater than count, but at most count names will be written to architectures.
Since
Haiku R1

◆ guess_architecture_for_path()

const char * guess_architecture_for_path ( const char *  path)

Returns the name of the architecture associated with the given path.

If the given path refers to an executable, library, or add-on, the function determines for which architecture it has been built and returns that. Otherwise it analyzes the path itself, checking whether it points to/into a directory where files for a secondary architectures reside. If that proved inconclusive the name of the primary architecture is returned.

Parameters
pathThe path to be analyzed. It doesn't necessarily have to point to an existing file or directory.
Returns
The name of the architecture determined from path.
Since
Haiku R1