Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Type of argument "string" in the dll

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

    Type of argument "string" in the dll

    Hello!
    Trying to work with NTDirect.dll from my C++ RAD2007 application and get exceptions often while trying to call SubscribeMarketData, UnsubscribeMarketData, MarketData.

    What type of arguments should I use for "string", for
    double
    MarketData(string instrument, int type),
    as example?

    I tried to use: AnsiString, std::string, std::wstring and got exception.

    Thanks in advance!


    #2
    second, a regular string should do it - are you sure you get this exception because of the string type used?

    Are you subscribing to MarketData first by calling SubscribeMarketData()?

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Are you subscribing to MarketData first by calling SubscribeMarketData()?
      Yes, I did it first.
      My sample code in Borland Builder C++:

      Code:
       
      AnsiString b = "ES 12-09";
      NT = LoadLibrary("NTDirect.dll");
      if (NT) {
          Connected2 = (Connected1 *)GetProcAddress(NT, "Connected");
          SubscribeMarketData2 = (SubscribeMarketData1 *)GetProcAddress(NT, "SubscribeMarketData");
          UnsubscribeMarketData2 = (UnsubscribeMarketData1 *)GetProcAddress(NT, "UnsubscribeMarketData");
          TearDown2 = (TearDown1 *)GetProcAddress(NT, "TearDown");
          MarketData2 = (MarketData1 *)GetProcAddress(NT, "MarketData");
          }
      // Subscribe
      if(SubscribeMarketData2)  SubscribeMarketData2(b);
      Sleep(500);
       
      // Get data
      double s = MarketData2(b, 0);
      Form1->Label1->Caption = s;
      Sleep(500);
      
      // Unsubscribe
      if(UnsubscribeMarketData2) {UnsubscribeMarketData2(b); }
      if(TearDown2) TearDown2();    
      if (NT) FreeLibrary(NT);
      And often I get exceptions, sometimes at SubscribeMarketData, sometimes at MarketData. I was adviced that it might be from using wrong type of argument.
      What language the library was written? Delfi?

      Comment


        #4
        second, sorry not familiar with Borlands C++, but I believe you would need to convert the AnsiString being passed in - http://www.tek-tips.com/viewthread.c...=648627&page=9
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by pibrew, Today, 06:37 AM
        0 responses
        4 views
        0 likes
        Last Post pibrew
        by pibrew
         
        Started by rbeckmann05, Yesterday, 06:48 PM
        1 response
        14 views
        0 likes
        Last Post bltdavid  
        Started by llanqui, Today, 03:53 AM
        0 responses
        6 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        12 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        16 views
        0 likes
        Last Post AaronKoRn  
        Working...
        X