Announcement

Collapse
No announcement yet.

register DLL required?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • register DLL required?

    I'm thinking there is a simple solution to the following error:

    Gft.efs, line1: Can not find DLL(C:\path\to\dll\name.dll)

    Maybe registering the dll with regsvr or regsvr32? I've tried this although regsvr32 doesn't seem to find the DLL either. I know its there....maybe it is missing some important features (ActiveX or MFC or something). Does the DLL have to be a specific kind or will any DLL with exported functions work?

  • #2
    Hello auribe,

    Please review the notes on the DLL Object from our EFS KnowledgBase. Let us know if this helps solve the problem.
    Jason K.
    Project Manager
    eSignal - an Interactive Data company

    EFS KnowledgeBase
    JavaScript for EFS Video Series
    EFS Beginner Tutorial Series
    EFS Glossary
    Custom EFS Development Policy

    New User Orientation

    Comment


    • #3
      DLL Document

      I tried to access the lnk that you have provided in how to call a DLL, however the link is not valid. Would you mind providing me with an updated link.

      I have created a DLL with the following function that I have created using c#

      public bool SendNotification(string strMessageSubject, string strMessageBody,string strFrom,string strTo, string strCC)


      I try to access it from EFS as follow:

      var eMail=new DLL("C:/Program Files/eSignal/Formulas/Wizard/Trading/SendEmailInfo.dll");

      eMail.addFunction("SendNotification",DLL.STR,DLL.S TR,DLL.STR,DLL.STR,DLL.STR);


      however it complains about the return type when I try to use the eMail.addFunction . I am not sure where to place the return type? probably more of a syntax problem than anything else.

      Thanks

      Ben G.
      Tony Gof

      Comment


      • #4
        Hello Ben,

        I've fixed that link. Please try it again.

        As to the return type, I think you need to change it to DLL.STRING. That parameter is expecting one of the following types.

        DLL.DOUBLE
        DLL.INT
        DLL.SHORT
        DLL.FLOAT
        DLL.STRING
        Jason K.
        Project Manager
        eSignal - an Interactive Data company

        EFS KnowledgeBase
        JavaScript for EFS Video Series
        EFS Beginner Tutorial Series
        EFS Glossary
        Custom EFS Development Policy

        New User Orientation

        Comment


        • #5
          Syntax issue

          Thank you for updating the link. The following is the code I have written in cSharp and calling it from my efs. Would you mind looking at what I am doing wrong. the EFS complains that it can not find the SendNotification function in my DLL.

          Thank you

          Ben G

          ///////////c-Sharp code///////

          using System;
          using System.Collections.Generic;
          using System.Text;
          using CDO;
          using System.Web.Mail;

          public class SendMessage
          {
          public int SendNotification(string strMessageSubject, string strMessageBody,string strFrom,string strTo, string strCC)
          {

          try
          {
          MailMessage message = new MailMessage();

          message.From = strFrom;
          message.Cc = strCC;
          message.To = strTo;
          message.Subject = strMessageSubject;
          message.Body = strMessageBody;
          System.Web.Mail.SmtpMail.SmtpServer="127.0.0.1";
          System.Web.Mail.SmtpMail.Send(message);

          return 1;
          }

          catch (Exception ex)
          {
          return 0;
          }

          }


          }

          ////////////// end of c# code ///////////////

          //////////My efs code ///////

          var eMail=new DLL("C:/Program Files/eSignal/Formulas/Wizard/Trading/SendEmailInfo.dll");

          function main()
          {

          if // ( someCondition becomes true)
          sendEmailMessage();

          }


          function sendEmailMessage()
          {
          var emailSuccess=0;
          eMail.addFunction("EmailMe", DLL.INT, DLL.CDECL,"SendNotification",DLL.STRING,DLL.STRING ,DLL.STRING,DLL.STRING,DLL.STRING);

          emailSuccess= eMail.call("EmailMe","Test","test Body","[email protected]","[email protected]","[email protected]");


          }
          Tony Gof

          Comment


          • #6
            Hello Ben,

            Your EFS syntax looks fine. I'm not a C# developer, so I'm not able to say what may be wrong with that code. If you attach a copy of your dll example I'll try testing it on my end. I may be able to get one of our internal developers to take a look at it. I can't make any promises on that as they are pretty busy with the current beta.

            One suggestion I can make for the time being is to place the dll in your \eSignal\ folder and don't specify the path in the new DLL() call. The dll does not need to be registered if you do it this way. Try that first and let me know if that makes any difference.
            Jason K.
            Project Manager
            eSignal - an Interactive Data company

            EFS KnowledgeBase
            JavaScript for EFS Video Series
            EFS Beginner Tutorial Series
            EFS Glossary
            Custom EFS Development Policy

            New User Orientation

            Comment


            • #7
              I tried that but it still complains about not being able to find the SendNotification function in my DLL, however in both scenarios i does see the DLL. I do not have a clear understanding of DLL.CDECL, I have searched for it on the web, however I did not have much luck. The definition says;

              the calling convention of the exported DLL function. must be one of the following:

              DLL.CDECL
              DLL.STDCALL

              If you can direct me to some source so I can dig deeper in this I would appriciated.

              Thank you

              Ben G.
              Tony Gof

              Comment


              • #8
                -

                Hello Ben,

                Try an Internet search for "CDECL calling convention for C#."
                Jason K.
                Project Manager
                eSignal - an Interactive Data company

                EFS KnowledgeBase
                JavaScript for EFS Video Series
                EFS Beginner Tutorial Series
                EFS Glossary
                Custom EFS Development Policy

                New User Orientation

                Comment


                • #9
                  Ben,

                  One of the problems is you have not declared your SendNotification function as static.

                  You should have public static int SendNotification(.....)

                  Another issue is you would access this by using SendMessage.SendNotification(...) but you are only using SendNotification in your AddFunction call, which is probably why it can't be found.

                  Lastly you're calling the AddFunction routine every time you send a message. You should only call it once.

                  The CDECL and STDCALL just determine the order the parameters are placed on the stack before the DLL call is made. If you pick the wrong one I believe your strings will be in the reverse order of what you expect. i.e. strCC will be the first parameter instead of the last. Your try/catch block may fire if that's the case. I think CDECL is the right one to use for C#.

                  Hope this helps.

                  Steve

                  Comment


                  • #10
                    Thanks Steve;

                    I did change the function to Static in the DLL. As far as I know you would use static if you do not want to instantiate the objeect and be able to call its methods, at least that is the case in C#.

                    As for calling the Function I have tried three different ways:

                    1-SendEmailInfo.SendMessage.SendNotification using the FQN including the namespace

                    2-SendMessage.SendNotification using the class name and the function

                    3- SendNotification and just the function by itself.

                    I ahve placed the library in two different location both in esignal folder as well as where my efs is located.

                    In any case I am still getting the error when I am making the call to the function which it says that the function can not be found in the DLL.

                    I have posted the code for the efs at the bottom of the message, as for C# code I just added the static keyword to my function:


                    /////////////Start of C# Code////////////////

                    using System;
                    using System.Collections.Generic;
                    using System.Text;
                    using CDO;
                    using System.Web.Mail;

                    namespace SendEmailInfo
                    {
                    public class SendMessage
                    {
                    public static int SendNotification(string strMessageSubject, string strMessageBody, string strFrom, string strTo, string strCC)
                    {

                    try
                    {
                    MailMessage message = new MailMessage();

                    message.From = strFrom;
                    message.Cc = strCC;
                    message.To = strTo;
                    message.Subject = strMessageSubject;
                    message.Body = strMessageBody;
                    System.Web.Mail.SmtpMail.SmtpServer = "127.0.0.1";
                    System.Web.Mail.SmtpMail.Send(message);

                    return 1;
                    }

                    catch (Exception ex)
                    {
                    return 0;
                    }

                    }


                    }

                    }


                    /////////////////////End of C# Code////////////////


                    ///////////////////Start of EFS code//////////////////


                    var vEmailNotoficationSender;
                    var vEmailNotoficationTo;
                    var vEmailNotoficationCC;

                    var blnFirstLoad=false;


                    //var eMail = new DLL("C:\\Program Files\\eSignal\\Formulas\\Wizard\\Trading\\SendEma ilInfo.dll");

                    var eMail = new DLL("SendEmailInfo.dll");

                    function preMain()

                    {

                    setPriceStudy(true);

                    eMail.addFunction("EmailMe", DLL.INT, DLL.CDECL, "SendEmailInfo.SendMessage.SendNotification", DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING, DLL.STRING);


                    var fp1 = new FunctionParameter("EmailNotoficationSender", FunctionParameter.STRING);
                    fp1.setName("Email Notofication Sender");
                    fp1.setDefault("[email protected]");

                    var fp2 = new FunctionParameter("EmailNotoficationTo", FunctionParameter.STRING);
                    fp2.setName("Email Notofication To");
                    fp2.setDefault("[email protected]");


                    var fp3 = new FunctionParameter("EmailNotoficationCC", FunctionParameter.STRING);
                    fp3.setName("Email Notofication CC");
                    fp3.setDefault("[email protected]");


                    }

                    function main(EmailNotoficationSender,EmailNotoficationTo,E mailNotoficationCC)
                    {

                    vEmailNotoficationSender=EmailNotoficationSender;
                    vEmailNotoficationTo=EmailNotoficationTo;
                    vEmailNotoficationCC=EmailNotoficationCC;

                    if (blnFirstLoad==false)
                    {
                    blnFirstLoad=true;
                    drawTextPixel( 20 , 80 , "Send Email@URL=EFS:SendEmailNotification", Color.red, Color.grey, Text.BUTTON | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, "Courier New", 11, "SendEmailNotification");

                    }

                    }


                    function SendEmailNotification()
                    {
                    var emailSuccess=0;
                    emailSuccess= eMail.call("EmailMe","Test","test Body","FromSomeone@someplace","ToSomeone@someplace .com","[email protected]");


                    }

                    ///////////////////End of EFS code//////////////////


                    Thanks for your input. Have you tried calling the ADO.Net such as Dataset from javascript?

                    Ben G.
                    Tony Gof

                    Comment


                    • #11
                      Ben,

                      After looking into this further I'm begining to wonder if it's even possible. C# is a managed language, and exposing managed functions to unmanaged code (JavaScript) is not a trivial thing.

                      I've done DLL's that interface with efs code before, but they were in unmanaged C++.

                      Can you use the dumpbin program on your dll to see what functions it is exporting?

                      In C++ you have to explicitly tell it a function is to be exported. So my thought is that you aren't exporting the SendNotification function, so unmanaged code can't see it. In fact, looking at the C# reserved word list, I don't see any export related words.

                      You could try rewriting your code in unmanaged C++ if you have a compiler for that.

                      Steve

                      Comment

                      Working...
                      X