next up previous contents
Next: Backward compatibility Up: IRAM Memo 2011-3 CLASS Previous: API summary   Contents

Extending the standard CLASS capabilities

The previous sections describe how to write and read a User Section in/from a CLASS file. This was assumed to be done from an external program linked to be CLASS library. However, it is also possible to do this directly from the standard CLASS executable. The key point is to define all the support subroutines for the User Section in a binary, dynamically loadable library (say libowner.so), linked to the CLASS library. libowner.so must also define a specific entry point and its associated definition subroutines, as described in the document named New package initialization3.

From a standard CLASS session, the command SIC$\backslash$IMPORT can then be used to load the libowner.so library and import the User Section capabilities. Such a session will look like:

LAS90> ! First, Class does not know how to read the User Section:
LAS90> DUMP /SECTION USER
 USER ------------------------------------------------------
  Number of subsections: 1
  User Section #   1
    Owner:         OWNER
    Title:         TITLE
    Version:       1
    Data length:   5
    Data:
      (can not dump)
LAS90>
LAS90> ! Load 'libowner.so'
LAS90> SIC\IMPORT OWNER
LAS90>
LAS90> ! Now Class knows how to read it:
LAS90> DUMP /SECTION USER
 USER ------------------------------------------------------
  Number of subsections: 1
  User Section #   1
    Owner:         OWNER
    Title:         TITLE
    Version:       1
    Data length:   5
    Data:
      datai4 =          111
      datar4 =    222.00000
      datar8 =    333.00000000000000
      datac4 = ABCD
LAS90>



Gildas manager 2014-07-01