When compiling with X# you do not add the ClassLibrary Attribute yourself. The compiler does that for you and includes the name of the class that it generated that contains all the functions in your assembly.
Only if you code in C# then you have to add this attribute.
If you want to tell the compiler about additional namespaces, then you should use the ImplicitNamespace attribute. There can be more than one of this attribute.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Yes, I want to use a class library written in C# in an X# project. Unfortunately, applying the specified attributes does not allow me to compile the X# console application. Can I see such examples or send you my solution (.sln) that doesn't work?
If you write the code as a function then the compiler generates the ClassLibrary attribute.
There is no easy way to automatically add USING STATIC commands to a project.
If you want to centralize code in a class, you can also create a function that calls that method.
We have done that on several locations in the runtime too:
For example:
FUNCTION MemVarGet(cVarName AS STRING) AS USUAL
RETURN XSharp.MemVar.Get(cVarName)
We are planning support for GLOBAL USING and GLOBAL USING STATIC in a future release.
When that is available then you can add this in one location and it will work in the whole project.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
To make the X# compiler automatically recognize your C# static method as a function, you will have to add an attribute to the C# assembly (and not the X# assembly)
The code below assumes that the functions are in the XbTools.XbTools class, and that the namespace XbTools may contain classes that you want the compiler to automatically recognize.
using XSharp;
using XSharp.Internal;
[assembly: ClassLibrary("XbTools.XbTools", "XbTools")]
The ClassLibrary attribute can only appear once.
If you have more namespaces that you want the compiler to automatically include when searching for class you can add the ImplicitNamespace attribute as well
Hello. I'm trying to set up a compatible string comparison using the X# compiler flag -vo13 and functions SetInternational, SetCollation, SetNatDll. The following code:
Den,
The sort order is controlled by the russian collation. I would have to check what the contents of that collation is.
We extracted that sort order from the clipper / vo collation table
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu