Porting Guide (libshared)

From liblfds.org
Revision as of 15:53, 1 April 2018 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


To permit libshared to work on a range of platforms a porting abstraction layer has been written. Porting simply involves implementing the porting abstraction layer; the library will then compile and work. Implementation involves providing values to a small set defines, macros and typedefs and implementing one or two functions.

The Porting Abstraction Layer

The porting abstraction layer consists of one header file and two C files, thus;

        │   └───libshared
        │       └───libshared_porting_abstraction_layer_operating_system.h

Each header file uses #ifdefs and compiler defined macros to select the appropriate porting abstraction layer implementation for the local platform.

Accordingly, to add a new platform, introduce a new #ifdef, which matches the appropriate compiler defined macros for your platform.



#define LIBSHARED_PAL_THREAD_RETURN_CAST( return_value )

typedef [type] libshared_pal_thread_handle_t;
typedef [type] libshared_pal_thread_return_t;

Additionally, in this file, include any needed OS provided header files.


int libshared_pal_thread_start( libshared_pal_thread_handle_t *thread_handle,
                                struct libshared_pal_thread_info *pti )


void libshared_pal_thread_wait( libshared_pal_thread_handle_t thread_handle )

See Also