Origin C is a high-level language closely based on ANSI C. In addition, Origin C supports a number of C++ features—including classes, mid-stream variable declarations, overloaded functions, references, and default function arguments. Origin C also supports collections and the foreach and using statements from the C# programming language.
Origin C programs are developed in Origin’s Integrated Development Environment (IDE), Code Builder. Code Builder includes a source editor with syntax highlighting, a workspace window, compiler, linker, and debugger. For details, see Help: Programming: Code Builder.
Using Origin C lets you fully leverage Origin’s data import/handling, graphing, analysis, and image export. Applications written in Origin C typically execute much faster than equivalent LabTalk scripts.
This quick tutorial shows how to use Code Builder to create an Origin C function and call it from Origin. The function is simple, but the workflow is the same for larger projects.

int test() { printf("hello, world\n"); // Print text; \n is the newline character return 0; // Exit our function, returning zero to the caller }

Once an Origin C file is successfully compiled and linked, all functions defined in it can be called as script commands anywhere in Origin that supports LabTalk during the current session. To be callable from script, function parameters and return values must meet certain criteria; there are also techniques to keep such functions always available. For details, see Origin C Functions (LabTalk Guide).
|