Please enable JavaScript to view this site.

thinBasic Help Manual

* * HELP & MANUAL PREMIUM PACK 4 DEMO VERSION * *

This documentation was styled with a demo skin from the Premium Pack 4 add-on for Help & Manual. The contents of the skin are encrypted and not configurable. You can only publish HM projects with this skin. You cannot edit it or change it.

This version is copyright and may only be used for local testing purposes. It may not be distributed.

Please purchase the full version of the Premium Pack to get the configurable skins and remove this notice. The package will also include the Toolbox configuration utility for Premium Pack skins.

 

Description

 

Defines section of external compilers source code inside ThinBASIC script.

 

Syntax

 

#Compiled [SuppressRTE] [language = INISectionLanguageName]

 {source code statements and exported functions}

#EndCompiled

 

Returns

 

Parameters

 

Name

Meaning

INISectionLanguageName

Is the name of the INI section name specified inside \thinBasic\Compilers\thinBasic_Compilers_Usr.ini containing compiler options

 

Remarks

 

There can be multiple #Compiled / #EndCompiled sections in your thinBasic script(s).

 

The content of all #Compiled / #EndCompiled sections will be concatenated into a single source code and compiled automatically by ThinBASIC into a single DLL to be usable from thinBASIC script.

 

DLL will be named with the same name of the ThinBASIC script and placed into the same directory.

The name of the compiled DLL can be retrieved at script runtime via Compiled_DLL_FileName command.

 

In case there are functions or subs defined inside the #Compiled / #EndCompiled, they can be used directly from ThinBASIC code without the need to declare them if and only if:

1.they use CDECL calling convention

2.they use EXPORT to be visible from DLL

 

If SuppressRTE option is present, no classic thinBasic runtime error will occur in case of errors

 

Language option is used to specify compiled languages configuration section.

Actually ONLY FreeBasic is allowed in case Language option is specified - at the moment.

 

Restrictions

 

If compiled code will contain errors, a standard ThinBASIC runtime error window will appear showing output from external compiler.

 

If programmer wants to handle compiler errors, use SuppressRTE option. In this case no ThinBASIC runtime error window will appear and programmer can use Compiled_LastCompile_Result and Compiled_LastCompile_Output functions to handle errors.

 

See also

 

Examples

 

#Compiled Language = FreeBasic

 

sub SayHelloFromFreeBasic cdecl alias "SayHelloFromFreeBasic" (byref sMessage as zstringexport

  print sMessage

end sub

  

#EndCompiled

 

uses "Console"

 

' Thanks to thinBASIC autodetection,

' the FreeBasic function is discovered automatically

SayHelloFromFreeBasic("Hello, BASIC")

 

printl "Press a key to end..."

waitKey

 

Created with Help+Manual 8 and styled with Premium Pack Version 4 © by EC Software