Navigation:  thinBasic Modules >

Uses

Previous pageReturn to chapter overviewNext page

 

Description

 

This special function is used to load modules into thinBasic scripts at runtime.

 

Syntax

 

n = USES(ModuleName)

n = USES ModuleName

 

Returns

 

Number.

If number is negative, it is an error code.

If number is positive, it indicates the directory where the module has been found. See table below for path sequence.

 

Possible error return codes:

Code

Meaning

>=0

No error. Library loaded

-1

Error: library not found. Script execution process will continue in any case.

-2

Error: library exists but thinBasic entry point not found. Script execution process will continue in any case.

-3

Error: library already loaded. Script execution process will continue in any case.

 

Parameters

 

Name

Type

Optional

Meaning

ModuleName

String

No

A string expression indicating the name of the module to load

 

Remarks

 

When executed, USES search for a module name starting with "thinBasic_" plus the string passed as parameter plus ".dll".

 

For example,

 

USES "Console"

 

will search for "thinBasic_Console.dll" file name.

 

USES will search for the requested module following below path sequence:

 

 1. Source script path

 2. Source script path + Lib

 3. Source script path + Bin

 4. Source script path + Mod

 5. Source script path + Lib + "thinBasic_" + ModuleName

 6. Source script path + Bin + "thinBasic_" + ModuleName

 7. Source script path + Mod + "thinBasic_" + ModuleName

 

11. thinBasic path

12. thinBasic path + Lib

13. thinBasic path + Bin

14. thinBasic path + Mod

15. thinBasic path + Lib + "thinBasic_" + ModuleName

16. thinBasic path + Bin + "thinBasic_" + ModuleName

17. thinBasic path + Mod + "thinBasic_" + ModuleName

 

If none of the above will be valid, a runtime error will be generated.

 

Restrictions

 

See also

 

Modules,

 

Examples

 

 

 

 

 

© 2004-2008 thinBasic. All rights reserved. Version 1.7.0.0 Web Site: http://www.thinbasic.com