简体   繁体   English

为 Easylanguage 创建 C# dll

[英]Creating a C# dll for Easylanguage

I am an experience Easylanguage coder.我是一名经验丰富的 Easylanguage 编码器。 Easylanguage is a high level language used by Tradestation (trading platform). Easylanguage 是 Tradestation(交易平台)使用的高级语言。 Easylanguage can utilize dlls as in this example: Easylanguage 可以使用 dll,如下例所示:

DefineDLLFunc:  "Calculator.dll", float, "Subtract", float, float;

I have created the Calculator.dll using Visual Studio 2019.我使用 Visual Studio 2019 创建了 Calculator.dll。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Calculator
{
    Public class Functions
    {
            public float Subtract(float a, float b)
            {
                return a - b;
            }

            public float Multiply(float a, float b)
            {
                return a * b;
            }

            public float Divide(float a, float b)
            {
                return a / b;
            }

            public float Power(float a)
            {
                return a * a;
            }
    }
}

I did the build step and it created the dll file, but this is lacking something because when I try to access the dll from Easylanguage, it cannot find any of the functions.我做了构建步骤,它创建了 dll 文件,但这缺少一些东西,因为当我尝试从 Easylanguage 访问 dll 时,它找不到任何功能。 I'm missing a step or two on production of the dll.在生产 dll 时,我缺少一两步。 What is it?它是什么?

I don't think you can use DefineDLLFunc to call .NET assemblies.我认为您不能使用 DefineDLLFunc 调用 .NET 程序集。 This method only seems to work for native DLLs and not managed (.NET) DLLs.此方法似乎仅适用于本机 DLL,而不适用于托管 (.NET) DLL。 For .NET DLLs you may have to use COM.对于 .NET DLL,您可能必须使用 COM。 This is just a guess, because I'm not familiar with EasyLanguage.这只是一个猜测,因为我不熟悉 EasyLanguage。 But you may check this website for interop with EasyLanguage: https://www.tradestationchina.com.cn/knowledge-base-/understanding-tradestation-compatible-dlls-part-iii/但是您可以查看此网站与 EasyLanguage 的互操作: https://www.tradestationchina.com.cn/knowledge-base-/understanding-tradestation-compatible-dlls-part-iii/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM