ChorusOS 4.0 Production Guide

Updating your Application with Source Files in Several Directories

Applications may have several source files in different directories. These files may be accessed using links. This example shows how to create a link between the files.

Define the BYE flag by creating a bye.df file in your MYCOMP/src, including the following information:

DEFINES="-DBYE"

The bye() function will be called once the BYE flag is defined in the compilation options.

Remove the MYCOMP build directory and run make again as follows:

host% rm -rf /<work_dir>/build-MYCOMP
host% make

The link phase fails because the bye() function in not defined properly.

Create a new directory (bye) in your src directory and define the bye() function in the bye.c source file by including the following information in the file:

void bye() {}

The bye.c file is not in the same directory as the .df file. You must create a .mf file, bye.mf, in your bye directory containing the following information:

C__SRCS = bye.c

Run make again and the link phase will succeed.

host% make

Note, the bye.o object file has been automatically added to the list of files used to link hello. To display this list, use the getExport command:

host% <bin_dir>/host/bin/getExport build-MYCOMP/src
build-MYCOMP/src/bye/bye.o
    build-MYCOMP/src/hello.o