Previous: Using the command line, Up: Run-time configuration


4.2.4 Using a source file

Many embedded systems do not have a filesystem or a shell, so the previous run-time configuration methods cannot be used on these targets. On these platforms, a PolyORB node can also be configured using the API of package PolyORB.Parameters.Static. An example configuration file may be found in examples/static/po_static_conf.ads.

An array of PolyORB parameters of type Static_Parameters_Array is first declared containing a list of pairs of Variable and Value strings. The syntax is close to the one described in configuration files. A variable Var.Iable in section [Sec] is specified as the pair of strings "[sec]var.iable", "<value>".

There is no need to with this po_static_conf.ads in the application source code, the only requirement is that the array is exported with the external name "__polyorbconf_optional". This allows to modify PolyORB parameters without recompiling the application, just relinking it. For example:

       $ gnatmake -c po_static_conf.ads `polyorb-config`
       $ gnatmake -b -l server.adb `polyorb-config` -largs po_static_conf.o

Note the -l flag to gnatmake for linking only, and the need to specify to the linker the object file with the array using -largs if no package withs it.

It should be noticed that this static array of parameters is read at elaboration time only, this API cannot be used to modify the PolyORB configuration at run-time.