[SESI logo]

Prisms Development Toolkit Documentation

Side Effects Software Inc. 1997

Dynamic SOPs

Dynamic SOPs

Dynamic SOPs are SOPs that can be loaded into action while it is running. This has several benefits:
  • Compiling custom versions of action may not be necessary.
  • SOPs can be shared between users and sites, without revealing source code.
  • Different combinations of custom SOPs can be used without compiling special versions of action for each.
  • SOPs can be updated without recompiling action.
  • Sharing SOPs requires transferring a lot less data than sharing versions of action
  • Compiling DSOs

    You should be familiar with the custom compile - if you are not, read that section first.
    Dynamic SOPs are compiled as DSOs (Dynamic Shared Objects) which can then be loaded into action at runtime. To do this, the command customDSO has been added to the PRISMS baseline. This command has the following syntax:

    customDSO [-o output.so] source1.c [source2.c ...]

    where output.so is the shared object to be created. This option only has meaning if a single source.c file is indicated on the command line. Where multiple source files are given, multiple .so files are created.

    Examples:

    customDSO -o wave.so mysop.c

    creates a file wave.so containing the relocatable compilation of mysop.c
    customDSO mysop.c hissop.c hersop.c
    creates mysop.so, hissop.so and hersop.so
    customDSO -o output.so eeny.c miney.c moe.c
    is an error.

    Loading Dynamic SOPs into Action

    To load the compile SOP into action, use the command sopdload. The syntax for this command is:

    sopdload DSOfile Sop_entry_point

    The DSOfile is the pathname of a .so file as created using customDSO. The Sop_entry_point is the name of the SOP routine. IMPORTANT! The SOP Entry Point is not the same as the name of the SOP. It is the name of the SOP_FUNC structure, also defined in usersop.c For example, say you create the following SOP_FUNC structure:

    
    SOP_FUNC  CircleSopRef = {      /* 1st: SOP name as in usersop.c */
           "circle",               /* 2nd: name as it appears in menu */
           "c:::O:p:r:",           /* 3rd: SOP params and how to parse */
           sopScan,
           sopPrint,
           sopCook,
           sopDefaults,
           sopClean,
           sopGPMake,
           sopGetParms,
           SOPUSAGE,
    };
    
    
    And say you compile this SOP by using
    customDSO circlesop.c

    Then the command to load this SOP into action would be
    sopdload circlesop.so CircleSopRef


    Tookit Overview
    Expression Functions | User Functions | Custom SOPs
    Prisms Internal Format | Programmer's Reference
    Compiling SOPs | Using sopbuild | SOP Routine Reference
    Dynamic SOPs | Prisms Types | Macros
    Math Routines | Data Routines | Polygon Routines | Winged-edge Routines

    Copyright © 1997 Side Effects Software Inc.
    477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7