Wiki
Version 5 (modified by Charles, 11 years ago)

--

Cobra Compiler Directives

Compiler directives are options, instructions or hints provided to compiler
from within code files. These may be items also provided as commandline args.

The various cobra Compiler directives are

@args
@ref
@help
@number
@platform
@error
@warning
@throw <---for internal use by cobra..

@args
Specifies the provision of a (cobra compiler commandline) arg.
The option follows the @args as if given on the compiler commandline.

e.g.

@args -t:winexe

specify a compiler option giving a commandline arg that indicates that the current assembly should be compiled as a Windows Executable

@args -lib:'C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0'

specifies a search directory for the cobra compiler to look in to find any referenced assemblies.

@ref

Indicates explicitly an assembly filename for the resolution of (used) references.

e.g.

@ref "PresentationFramework"

specifies referencing "PresentationFramework?" assembly from GAC which

could otherwise have been given as -ref:"PresentationFramework" on the commandline

@ref 'c:\somedirectory\validAssembly.exe'
@ref 'c:\somedirectory\validAssembly.dll'

specifies referencing assemblies by giving absolute paths to both .exe and .dll files

@help

See HelpDirective

@number

Set the actual numeric type for any uses of both the 'Number' type and the default numeric type for any fractional literals (such as '1.0').

This usually defaults to Decimal. ( see CommandLine option 'Number')

See http://cobra-language.com/trac/cobra/wiki/Troubleshooting

@platform
Directive to specify that this source is specifically intended (only) for a specific platform. Presumably the code uses libraries or API's only available on that platform. If the platform directive and the compiler option backend settings are not compatible compilation will be aborted.

Values may be one of :

  • any - default - build on any platform (explicitly)
  • portable - (future) build for a 'portable' platform
  • clr - build for a CLR platform ( .Net - Windows and mono)
  • jvm - build for a jvm platform
  • objc - (future) build for an objective-C platform

e.g.

@platform jvm
# build only on/for jvm platform 

@platform any
# same as default

Additional (or different) platforms may be supported (or completed) in the future.