Cind language documentation

Using linked libraries

The Cind execution software, while working, may use linked libraries (DLL files on the Windows systems, and SO files on the Linux systems). Connecting linked libraries allows to execute external functions, provided by the operation system, and by the other software, from the inside of the Cind program.

Getting library

Getting linked library may be done by using syntax of getting external objects, with "lib" word as the first argument. The second argument must be a name of the library.
For example:

var lmath = @("lib","math");

connects a math library and stores a handle to that library in lmath variable.
For more about external objects see External objects.

Executing functions from the library is as simple as calling methods of an object.
For example:

float y = lmath.sin(0.5);

calls sin function from above connected math library.
Which may be also done by selecting functions first:

fun sin = lmath.sin; float y = sin(0.5);

It is also possible to grab only one function from the library, by putting name of the function as a third argument.
For example:

fun sin = @("lib","math","sin"); float y = sin(0.5);

For more about calling functions see Functions and Function execution.

Connecting and removing library

The library may be connected to the Cind execution software only once, what means, that each next connection statement will returns the currently connected library.

The libraries are disconnected by the garbage collector, during internal memory cleanup, when it finds that they are no longer used (see Memory management).

List of libraries

List of the libraries included in this release:



Cind programming language 1.0.4

 

Advertisements