Navigation: Scripting Reference Manual > Functions & Subroutines > GetLib

 

GetLib

 

Contact Us: fredsupport@photonengr.com

 

Description

This function no longer applies to FRED v9.70+.  Currently there is no way to use a pre-compiled FRED library file.

 

Retrieves a previously compiled script library and returns the FRED library object.

 

Syntax

mylib = GetLib ( fname )

 

Parameters

mylib (Object)

The handle to the script library.

 

fname As String

The file name of the previously compiled script library.

 

Remarks

This function retrieves a previously compiled script library.  If there is a problem the function sets an error and returns NULL.

 

A compiled script library is any FRED script file that contains function and/or subroutines, and which has been compiled and saved via the "Script | Compile and Save..." menu item.  Typically, the compiled library file is given a .frl file name extension.

 

Once the library is retrieved, any function or subroutine defined in the library may be executed.  For example, if the library file "MylibFile.frl" contains a function called "Myfunc" that takes a Long argument and returns a Double value, then the following example script would execute "Myfunc". Note that the library resource should be released after its use.

 

Dim mylib As Object

Dim arg As Long

Dim val As Double

arg = 2

set mylib = GetLib( "MylibFile.frl")   'get the library

val = mylib.Myfunc( arg )              'execute "Myfunc"

set mylib = Nothing                    'release library resource

 

 

One restriction on the library functions and subroutines is that their argument types are limited to the intrinsic Visual Basic type.  That is, you can not pass in a user-defined type as an argument.

 

See Also

CreateLib

 

 

 

 

 

Copyright © Photon Engineering, LLC