sysLoadScript

C Scripting Language
Reference Manual
Version 4.4.0

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using the CSL executive
Language
Directives
System library
   sysCommand
   sysDate
   sysDateFormat
   sysDateTime
   sysDirectory
   sysElapsed
   sysEnvVar
   sysLoadScript
   sysLoadLibrary
   sysLog
   sysLogFile
   sysLogLevel
   sysPrompt
   sysSleep
   sysSecondsSince
   sysShow
   sysStartDate
   sysStartDateTime
   sysStartTime
   sysStartTimestamp
   sysTime
   sysTimestamp
   sysTrace
String library
Math library
Regular expression lib.
File library
Database library
Async Communication
Registry/Profile handling
Windows control
C API
C++ Class Interface
CSL links
  
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 >>