set_app_data

Creates a data area for a registered library.

Library:LibC
Service:Library

Syntax

  #include <library.h> 
   
  int set_app_data (
     int    lib_id,
     void  *data_area);
  

Parameters

lib_id

(IN) Specifies the ID of the registered library.

data_area

(OUT) Points to a data area for the registered library.

Return Values

If successful, returns 0. Otherwise, returns -1 and sets errno to one of the following:

Decimal

Name

Description

5

ENOMEM

No memory could be allocated.

9

EINVAL

A valid, registered library was not indicated by lib_id.

105

ENOCONTEXT

The calling thread does not have a valid LibC context. (It might be a CLib application.)

Remarks

Because a context is needed for set_app_data, it must be called on the application thread. To ensure context, you might need to wrapper the function with nxExportInterfaceWrapped.

The data area is for the registered library's own use and is hidden from the calling application.

Call get_app_data first to determine if a data area has already been allocated for the calling application. If zero is returned, allocate the necessary data structures and record their pointers by calling set_app_data.

For sample code, see Library.c.

See Also

get_app_data