Reference/TwoColon

From Kx Wiki
Revision as of 11:01, 11 October 2006 by Xrnd Ltd. (Talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

2:

The 2: function is a dyadic function used to dynamically load C functions into Kdb+. Its left argument is a symbol representing the name of the dynamic library from which to load the function. Its right argument is a list of a symbol which is the function name and an integer which is the number of arguments the function to be loaded takes.

Many more details and examples are in the Extending Kdb+ with C cookbook recipe.

Example

Let us assume we have a C function in cpu.so with the prototype:

K q_read_cycles_of_this_cpu(K x);

Then to make this available in a kdb+ session, we use 2: to dynamically load the function as follows:

read_cycles:`cpu 2:(`q_read_cycles_of_this_cpu;1)

See also


For a complete list of functions, see the kdb+ Function Reference.

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox