4.34 FAQ-394 How to load and call Origin C function without Code Builder open?

Last Update: 2/4/2015

Before you call your Origin C function from Origin, your function must be compiled and linked in the current Origin session. This can be done in Code Builder. However, in some situations, we want to do that without Code Builder open, for example, when running LabTalk script which depends on an Origin C function. To programmatically compile and link a source file, or to programatically build a workspace from a LabTalk script, the run.loadOC method of the LabTalk run object can be used.

err = run.LoadOC("myFile",[option]);

For example, the following code uses an option to scan the .h files in the Origin C file being loaded, and all other dependent Origin C files are also loaded automatically.

if(run.LoadOC(OriginLab\iw_filter.c, 16) != 0)
{
	type "Failed to load iw_filter.c!";
	return 0;
}

Keywords:load, call, oc, code builder, compile