ptrdvds
(Lurker)
2004-03-19 10:04 AM
include librarys etc with UDF

It would be great if kix could use a library with UDF.
It makes scripting a lot more easy.
This way we could scripts ones use many eg distribute to other kix users.

include('network.lib') or
include('\\hirogen\libs\network.lib')

Cheers,
Peter Davidse


Richard H.Administrator
(KiX Supporter)
2004-03-19 10:16 AM
Re: include librarys etc with UDF

The facility is already available

Just use CALL to install the function library at the top of your script:
Code:
CALL 'network.lib'
CALL '\\hirogen\libs\network.lib'




Glenn BarnasAdministrator
(KiX Supporter)
2004-03-19 02:09 PM
Re: include librarys etc with UDF

There's also an Include() UDF that locates the required library, searching in several folder locations. You should also look at the "Building large projects" on the KixForms BBS - This tool automatically identifies library functinos, scans your source for those functions, and includes them in a built script - ready for distribution. This allows breaking large projects into smaller, more managable components. Doc and I are working on a script that is nearly 9000 lines (so far).

Glenn


Les
(KiX Master)
2004-03-19 02:29 PM
Re: include librarys etc with UDF

IFAIK, Include is already being worked on (in regard to 4.5 and pretokenize) and should be discussed in the beta forum following the next (public) release.

Richard H.Administrator
(KiX Supporter)
2004-03-19 02:53 PM
Re: include librarys etc with UDF

CALL is suitable for loading libraries at run time.

The INCLUDE that has been proposed and may make it into a future release is not best suited to loading libraries for most applications.

The proposed INCLUDE is designed to in-line code when a script is tokenised, similar to linking static libraries into a single executable in languages like 'C'.

The benefit is that (when tokenised) the libraries are all included in the script file, so you have single tokenised script which you can distribute.

The bad news is that every script which has an INCLUDE is bloated by the copy of the libraries, and when you change the library you need to re-tokenise every script which uses it to get in new version included.

If you simply want a centralised store of common routines that you want to include in your scripts, CALL will do the job nicely and is already available.


Ruud van Velsen
(Hey THIS is FUN)
2004-04-01 12:59 PM
Re: include librarys etc with UDF

Just to let you know that the latest Alpha release includes an INCLUDE statement ;-)

Ruud