To fully understand this document, it is necessary to be acquainted with pd and to have a general understanding of programming techniques especially in C.
To write externals yourself, a C-compiler that supports the ANSI-C-Standard, like the Gnu C-compiler (gcc) on linux-systems or Visual-C++ 6.0 (vc6) on windos-plattforms, will be necessary.
In this document, the expression class refers to the realisation of a concept combining data and manipulators on this data.
Concrete instances of a class are called objects.
To avoid confusion of ideas, the expressions internal, external and library should be explained here.
Library-files have to follow a systemdependent naming convention:
library | linux | irix | Win32 |
my_lib | my_lib.pd_linux | my_lib.pd_irix | my_lib.dll |
The simplest form of a library includes exactly one external bearing the same name as the library.
Unlike externals, libraries can be imported by pd with special operations. After a library has been imported, all included externals have been loaded into memory and are available as objects.
pd supports to modes to import libraries:
The first method loads a library when pd is started. This method is preferably used for libraries that contain several externals.
The other method should be used for libraries that contain exactly
one external bearing the same name.
pd checks first, whether a class named ``my_lib'' is already loaded.
If this is not the case1, all paths are searched for a file called
``my_lib.pd_linux''2.
If such file is found, all included externals are loaded into memory by calling a
routine my_lib_setup()
.
After loading, a class ``my_lib'' is (again) looked for as a (newly loaded) external.
If so, an instance of this class is created, else the instantiation fails and an error is
printed.
Anyhow, all external-classes declared in the library are loaded by now.