User Tools

Site Tools


compiler_option_ins

/ins Compiler option

In VO all classes were without namespaces. In .Net that is not very common. For example: we have placed the VO SDK classes in the namespace VO. So Control is actually VO.Control. We did that because other libraries may also have a Control class (Windows.Forms, WPF etc.)

Of course, this would have meant that everyone would have to add a class “USING VO” in each source file where they are using the VO SDK classes. We realized that a change like that would make the transition from VO to X# (and Vulcan) too complicated. We have therefore added a mechanism to tell your app about namespaces that should be automatically included when searching for types. An author of a library can add a special attribute to an assembly to tell the compiler about the namespaces that should be included when searching for types. see https://www.xsharp.eu/runtimehelp/html/T_XSharp_ImplicitNamespaceAttribute.htm

The VO SDK assemblies all contain this attribute. See https://github.com/X-Sharp/XSharpPublic/blob/main/src/Runtime/VOSDK/Source/SharedSource/SDKAssemblyinfo.prg#L24

The compiler option /ins tells the compiler to check for this attribute and automatically include namespaces listed in this attribute when searching for types.

In the meantime, C# has added something similar. You can declare a “global using VO;” in your code only once, and everywhere in your code the VO namespaces will be included. In a future version of X# we will also support that. The advantage of that is that you can control which of the namespaces you want to be searched in your own code. The /ins is an “all or nothing” approach.

compiler_option_ins.txt · Last modified: 2024/09/11 06:36 by wolfgangriedmann