User Tools

Site Tools


Running a Dana program via static linking uses a compile-time configuration of components that cannot be changed later at runtime. It's a quick way to prototype and experiment with systems. It's also a good way to provide an entire collection of components in a single compiled object file, or to ensure that your program uses a specific set of components.

Each component is individually compiled and the “main” component declares a set of links. The main component, which will provide the App interface, will have a method which configures the group of components (by wiring them together) before launching the system's behaviour. An example is shown below.

The Dana linker (a program called dnl) is then used to resolve each of the main component's declared links against other selected components. The linker takes two components as parameters 1 and 2, and a third parameter specifying the link name within the component in parameter 1:

dnl MyApp.o Input.o -l iStdIn

The main component is then run directly using the Dana interpreter, for example:

dana MyApp

Note that in the linking step we could have linked our main component against any other components with the correct interfaces.

Dana's esher program uses static linking to form a specific collection of components in a single file.

Static linking is designed to support rapid prototyping or highly specific component collections and is not the way in which Dana programs are generally intended to operate. Instead we typically use dynamic linking with the help of a meta-program like esher which supports full runtime software evolution. See the dynamic linking section for more on this.

static_linking.txt · Last modified: 2014/04/23 05:47 by barryfp

Page Tools