Origin C is a high level programming language closely based on the ANSI C programming language. 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) named Code Builder. Code Builder includes a source code editor with syntax highlighting, a workspace window, compiler, linker, and a debugger. Refer to Help: Programming: Code Builder
for more information about Code Builder.Using Origin C allows developers to take full advantage of Origin's data import and handling, graphing, analysis, image export capabilities, and much more. Applications created with Origin C execute much faster than those created with Origin's LabTalk scripting language.
This tutorial will show you how to use Code Builder to create an Origin C function, and then access the function from Origin. Though the function itself is very simple, the steps provided here will help you get started with writing your own Origin C functions.
int test() { printf("hello, world\n"); // Call printf function to output our text // \n represents the newline character return 0; // Exit our function, returning zero to the caller }
![]() | Once an Origin C file has been successfully compiled and linked, all functions defined in the file can be called as script commands from anywhere in Origin that supports LabTalk script during the current Origin session. The function parameters and return value need to meet certain criteria for the function to be accessible from script and there are techniques to make such functions always avaliable. To learn more, please refer to the LabTalk Programming: LabTalk Guide: Calling X-Functions and Origin C Functions: Origin C Functions chapter of the LabTalk help file. This help file is accessible from the Help: Programming: LabTalk main menu in Origin. |