I'm trying to use dll interface, but I have a problem.
I use SetUp function ( I know this is optional, but it's just a test), and get this error message.
"Unable to connect to NinjaTrader(/2161262). Please make sure NinjaTrader is running"
I use "127.0.0.1" and 36973 for arguments of SetUp function. They are same as default value. I think I'm passing arguments in wrong way. Do you have any idea?
I use Window7 and Visual Studio2010. I also tried in my laptop(Windows XP, Visual Studio 2005), but same result.
This is my test code
#include "stdafx.h"
#include <string>
#include <windows.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
typedef int (__stdcall *NTLast)(string instrument, double price, int size);
typedef int (__stdcall *NTSetUp)(string host, int port);
NTLast Last = NULL;
NTSetUp SetUp = NULL;
HINSTANCE NTDLL;
NTDLL = LoadLibrary(L"C:/Windows/System32/NtDirect.dll");
if(NTDLL == NULL)
return 1;
Last = (NTLast)GetProcAddress(NTDLL,"Last");
SetUp = (NTSetUp) GetProcAddress(NTDLL, "SetUp");
string IP = "127.0.0.1";
int port = 36973;
rtn = (SetUp)(IP, port);
rtn = Last("TEST", 1.23, 2);
FreeLibrary(NTDLL);
return 0;
}

Comment