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

Node classes and types can use existing libraries (such as an open-source library that you've downloaded) and library modules that you create. Libraries make it possible for node classes and types to use existing code and to share functions.

Using a library

A node class, type, or Vuo library module (see below) can depend on other libraries. You specify those libraries in the node class's, type's, or library module's "dependencies" array in VuoModuleDetails.

For example, a node class that depends on a static library called libassimp.a, a dynamic library called libicuuc.dylib, and a Vuo library module called VuoWindow.bc would have this metadata:

"name" : "...",
"description" : "...",
"keywords" : [ ... ],
"version" : ... ,
"dependencies" : [ "assimp", "icuuc", "VuoWindow" ],
"node" : { ... }
});

Notice that the static and dynamic library names leave off the "lib" prefix, and the file extension is optional; libassimp.a becomes assimp or assimp.a, and libicuuc.dylib becomes icuuc or icuuc.dylib. The Vuo library names leave off the file extension; VuoWindow.bc becomes VuoWindow.

Writing a library module

If you want several node classes or types to share functions, then one option is to define those functions in a library module. The library module is a C or C++ file that you compile to an LLVM bitcode (.bc) file. An advantage of using a library module, as opposed to a regular library, is that the library module can list other libraries as dependencies.

Like a node class or type, a library module needs to define its metadata in VuoModuleDetails. For example, a library module that depends on libassimp.a, libicuuc.dylib, and VuoWindow.bc would have this metadata:

#include "module.h"
"name" : "MyLibrary",
"description" : "Provides functions for ...",
"keywords" : [ "model", "window" ],
"version" : "1.0.0",
"dependencies" : [ "assimp", "icuuc", "VuoWindow" ]
});

In a C++ library module, the above code needs to be enclosed by extern "C" { ... } so that symbols are exported with C names (instead of C++ mangled names).

If your library module is written in C, you can compile it with vuo-compile (

Todo:
reference https://b33p.net/kosada/node/5836). If your library module is written in C or C++, you can compile it with Clang. For example:
clang -cc1 -triple x86_64-apple-macosx10.6.0 -emit-llvm-bc MyModule.c -o MyModule.bc