Interface Usage

#### Search Results

Search

# Interface Usage

The interface is typically used in the following way (example: Call a Natural subprogram):

1. Determine the location of the Natural binaries.

2. Load the Natural Native Interface library.

3. Call `nni_get_interface` to retrieve an interface instance.

4. Call `nni_initialize` to initialize a Natural session.

5. Call `nni_logon` to logon to a specific Natural library.

6. Call `nni_create_parm` or a related function to create a set of parameters.

7. For each parameter

   - Call one of the `nni_init_parm` functions to initialize the parameter to the correct type.

   - Call one of the `nni_put_parm` functions to assign a value to the parameter.

   - Call `nni_get_parm_info` to create the `parameter_description` structure.

8. Call `nni_callnat` to call the subprogram.

9. For each modifiable parameter.

   - Call one of the `nni_get_parm` functions to retrieve the parameter value.

10. Call `nni_delete_parm` to free the parameter structures.

11. Call `nni_uninitialize` to uninitialize the Natural session.

12. Call `nni_logoff` to return to the previous library.

13. Call `nni_free_interface` to free the interface instance.

An example C program nnisample.c that shows the usage of the interface is contained in <install-dir>/natural/samples/sysexnni.