Origin users can share Origin C source code with one another by distributing either the source files themselves (.C, .CPP, .OCZ) or preprocessed files (.OP).
If it is not necessary for others to see your application's source code, it is highly recommended that you distribute the encrypted Origin C source files (.OCZ) or preprocessed files (.OP) for version before Origin 2015 instead of the source files (.C or .CPP).
For encrypted OCZ files, users only need to drag and drop them into Code Builder in Origin to view and edit content. A prompt will show up to ask for the password when you try to open it for the first time but it will be only asked once in same Origin session.
See the File Types in the Create and Edit an Origin C File section for more information.
![]() | When an encrypted OCZ file is open in Origin session, since Origin 2016 SR0 user can choose to re-save the *.ocz file as not encrypted *.c or *.cpp by selecting menu File: Save As and choose a file type in Save as type drop-down list. |
After creating an application, you can distribute it as a single package file to other Origin users.
Use Package Manager to package all the application files into a single package file (.OPX)
. Note that when adding your application files into the package, be sure to add the preprocessed files (.OP) or the source files (.C or .CPP). It is not necessary to add both.Users can install your application by dropping the package file directly into Origin.
The following is an example that shows how to package all the application files into one OPX file. The user can drop the package file into Origin to install, then click a button to run the source file.
void OnButtonClick() { Worksheet wks = Project.ActiveLayer(); DataRange dr; dr.Add(wks, 0, "X"); dr.Add(wks, 1, "Y"); GraphPage gp; gp.Create(); GraphLayer gl = gp.Layers(0); int nn = gl.AddPlot(dr); gl.Rescale(); }
[Main] if(0 == Run.LoadOC(%Y\OriginC\MyButton.c)) { OnButtonClick; }
Run.LoadOC(%Y\OriginC\MyButton.c);into LabTalk Script: After Installation in gird view to load the Origin C source file. This script will be run when you drop OPX into Origin to install this application.