Vuo  0.4.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages

If several node classes need to call the same function, you can define that function inside a dynamic library or an LLVM bitcode library. A node class can use the function by including the .h file where the function is declared and adding the library name to the node class's moduleDependencies array.

Consider the Count Characters node class:

This node class uses functions defined in a dynamic library called icuuc (in a file called libicuuc.dylib) and an LLVM bitcode library called vuostring.bc (in a file called libvuostring.bc).

In moduleDependencies, library names should not include the lib prefix (e.g., icuuc is OK, libicuuc is not OK). The file extension is optional for dynamic libraries (e.g., either icuuc or icuuc.dylib is OK). An extension is required for bitcode libraries (e.g., vuostring.bc is OK, vuostring is not OK).

If you define functions in a .c file, you can compile it to a .bc file using Clang. For example, this command compiles vuostring.c to libvuostring.bc:

clang -emit-llvm -I/usr/local/Cellar/icu4c/4.8.1.1/include -c vuostring.c -o libvuostring.bc

Calling functions from another node class