|
sysLoadScript |
|
sysLoadScript( const filename) // name of script file Compiles and loads a script file at runtime. The script is searched in the current working directory and all directories listed in environment variable CSLPATH. To access any functions or identifiers in the script they have to be forward declared. Example:
#loadLibrary 'ZcSysLib'
extern var foovar[]; // implemented in foo.csl
foo(var xy); // implemented in foo.csl
main()
{
sysLoadScript('foo'); // load foo.csl
foovar[1] = 1234;
foo('hello');
}
CSL won't load the same script more than once; any attempts to do so will be silently ignored. You may want to put the forward declarations into a file foo.csl and include that file at compile time. I recommend to do this by #loadScript rather than #include, because that will avoid multiple loading. (In C/C++ you would have to make constructions like #ifndef _FOO_ ... #define _FOO_ ... body ... #endif) Example:
#loadLibrary 'ZcSysLib'
#loadScript 'foo.csl' // forward declarations
main()
{
sysLoadScript('foo'); // load foo.csl at runtime
sysLoadScript("scripts\Foo.Csl"); // will be ignored since already loaded
foovar[1] = 1234;
foo('hello');
}
|
||||||||
| Copyright © IBK Landquart | Last revision: 27.05.2002 | << Back Top Next >> |