Compiling Instructions for Alias OpenModel and OpenAlias

In the distribution of Alias Studio or Alias PowerAnimator under /usr/aw/alias, there is a directory called ODS (an abbreviation for Open Digital Studio). Below this directory are three directories relevant to the Alias API. These directories are:

Development Environment Requirements

IRIX

Note that OpenModel and OpenAlias can only be built on machines running at least Irix 5.3 with at least version 4.0 of the C++ compiler. OpenModel files must use the C++ linker. OpenAlias files can be compiled with either the C (when using the C API example code) or C++ compilers.

On IRIX 6.2, at least version 6.2 of the C++ compiler will be necessary to build OpenModel or OpenAlias plug-ins. Use the 'versions -b -n compiler_eoe' command to see which version of the compiler is installed.

Alias V8.0 is qualified on IRIX 6.2 and not on IRIX 5.3. In most cases, OpenModel applications and OpenAlias plug-ins will work as well as Alias would on IRIX 5.3. If you intend to develop a plug-in or OpenModel application where the final binary should work on both IRIX 5.3 and 6.2 then compile and link the code on IRIX 5.3. On IRIX 6.2, symbols may be introduced during compile or link time that may not exist on IRIX 5.3 thus making the binary incompatible on the 5.3 Operating System.

Compiling and Linking OpenModel programs

For Alias OpenModel also ensure that the library path for the linker (in LFLAGS) includes this area:

-L$(ALIAS_LOCATION)/ODS/OpenModel/lib

For the dynamic libraries, ensure that the library path includes this area:

-L$(ALIAS_LOCATION)/lib

In addition, the LFLAGS variable should contain the options:

-lalias_api -lapi_memory -lm -lsun

The Makefiles in OpenModel/examples and OpenAlias/examples demonstrate how all this is done, and it is recommended that you study them before creating new Makefiles.

As well, if developing with the dynamic libraries of Alias OpenModel ensure that LD_LIBRARY_PATH is set to reference the Alias library directory. For example,

setenv LD_LIBRARY_PATH $ALIAS_LOCATION/lib

Compiling and Linking Plug-ins

Plug-ins are compiled using the same compile flags as OpenModel applications.

A plug-in is linked using the `-shared -all' options of CC. For example, if the plug-in is composed of the object files obj1.o obj2.o obj3.o then the plug-in would be linked by the following command:

CC -shared -all obj1.o obj2.o obj3.o -o output_name.plugin
To prevent the listing of unresolved OpenAlias symbols, you can also include the shared object $(ALIAS_LOCATION)/lib/libLiveData.so.

The linking line would become:

CC -shared -all obj1.o obj2.o obj3.o -o output_name.plugin -L $(ALIAS_LOCATION)/lib/ libLiveData.so
Warning: do not use `ld' to link C/C++ plug-ins otherwise global variables may not be correctly initialized and static constructors/destructors will not be executed.

AIX 4.1

C Set ++ V3 for AIX is required for developing plug-ins under AIX 4.1. The utility makeC++SharedLibrary is used to produce the final plug-in binary. This utility is required for the proper handling of static constructors and destructors. Please read the "Working with Shared Libraries" chapter of the "CSet++ for AIX User's Guide" for further details.

Compiling and linking OpenModel programs

Currently, OpenModel links libraries statically under AIX. The library path for the linker should be set to

-L$(ALIAS_LOCATION)/ODS/OpenModel/lib

In addition, the LFLAGS should contain the options:

-lalias_api -lapi_memory -lapi_image -lm -lodm -lcfg

The Makefiles in OpenModel/examples and OpenAlias/examples provide an example on how to create AIX OpenModel and OpenAlias Makefiles.

Compiling and Linking Plug-ins

Plug-ins under AIX 4.1 require the makeC++SharedLib utility included with CSet++ Version 3. In addition, the exports list file of OpenAlias must be included in the options of makeC++SharedLib. The OpenAlias specific exports list file of Alias is called OpenAlias.exp and is distributed in the $ALIAS_LOCATION/ODS/OpenAlias/examples directory.

makeC++SharedLib -p 10 -I $ALIAS_LOCATION/ODS/OpenAlias/examples/OpenAlias.exp
-n an_entry_point -o output_name.plugin obj1.o obj2.o ...
The -p option sets the priority level of the static constructor initialization and allows plug-ins with static classes to initialize properly when the plug-in is called. The entry point is currently set to a function located in the pluginGlue.o file as will be described next.

Shared libraries under AIX 4.1 have one entry point. Plug-ins require two standard entry points ( plugin_init and plugin_exit ) that are called from Alias. The file pluginGlue.o contains the single entry point of the shared library (or plug-in) and is used to return the plugin_init and plugin_exit entry points back to Alias.

Plug-ins under AIX require an exports list. This list is located in $ALIAS_LOCATION/ODS/OpenAlias/examples/OpenAlias.exp and is specified with the Import option to makeC++SharedLib. This file contains the API symbols that are exported from Alias for plug-ins to use and the name of the binary that exports the symbols. The name of the binary is set to .Alias. Plug-ins will fail to load if the Alias binary is renamed to something other than .Alias. A message will be written to the error log in this situation.

The Makefile in $ALIAS_LOCATION/ODS/OpenAlias/examples can be used as the basis for building other AIX 4.1 specific Makefiles.

Building the Included Examples -- IRIX or AIX

Create an empty directory and copy the relevant Makefile to it. The two versions (OpenModel and OpenAlias), are in $(ALIAS_LOCATION)/ODS/OpenModel/examples or in $(ALIAS_LOCATION)/ODS/OpenAlias/examples.

Type:

make copy

This will copy all the source code for the examples to the current directory. Then type make to compile all the examples. (Note that this assumes that Alias is installed in the default location, if it is not, ALIAS_LOCATION must be set in the Makefile or in the environment as described above.)





aliasdocs@aw.sgi.com
Copyright © 1996, Alias|Wavefront, a Silicon Graphics Company. All rights reserved.