简体   繁体   中英

Creating a C# dll for Easylanguage

I am an experience Easylanguage coder. Easylanguage is a high level language used by Tradestation (trading platform). Easylanguage can utilize dlls as in this example:

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

I have created the Calculator.dll using Visual Studio 2019.

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. I'm missing a step or two on production of the dll. What is it?

I don't think you can use DefineDLLFunc to call .NET assemblies. This method only seems to work for native DLLs and not managed (.NET) DLLs. For .NET DLLs you may have to use COM. This is just a guess, because I'm not familiar with EasyLanguage. But you may check this website for interop with EasyLanguage: https://www.tradestationchina.com.cn/knowledge-base-/understanding-tradestation-compatible-dlls-part-iii/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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