I have added the DLL as a reference in the C# program with:
right clik (in the C# IDE)->references...->add->(navigate to
Interop.JDLLServerLib.dll)
and have the lines:
using JDLLServerLib;
and
JDLLServerClass j = new JDLLServerClass();
in my c# program. The intellisense recognises all of the things that
are inside JDLLServerClass ... which to me inidicates that the DLL
file was found correctly. But when I run the program I get the error:
14/12/2009 13:02:34,Strategy,Error on calling 'OnBarUpdate' method for
strategy 'JayServerExample': Could not load file or assembly
'Interop.JDLLServerLib, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. The system cannot
find the file specified.,
It's a long shot becuase it is nothing to do with J, but does anybody
have any ideas what I might need to do? [PS, I have only used C# since
last week so really don't quite "get it" at this stage!]
Thanks,
Matthew.
For reference, the c# program is:
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
using JDLLServerLib;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Example of communcation with J
/// </summary>
[Description("Example of communcation with J")]
public class JayServerExample : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion
/// <summary>
/// This method is used to configure the strategy and is
called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
Print(Bars.Count);
JDLLServerClass j = new JDLLServerClass();
}
#region Properties
#endregion
}
}
2009/12/12 Matthew Brand <[email protected]>:
> That did it, thanks :-).
>
> PS. For anyone else with this problem, if you get a domain error when
> you run the command:
> wd 'exec *',BINPATH,'\jreg.bat'
>
> it might be that you need to run as administrator in which case execute:
> BINPATH,'\jreg.bat'
>
> to see where the file is and go to it in windows explorer, right click
> and select run as administrator.
>
> 2009/12/12 Dan Bron <[email protected]>:
>> Matthew wrote:
>>> But the JDLLServer does not appear on the COM tab for me. Is there
>>> something I need to install first?
>>
>> Try running wd 'exec *',BINPATH,'\jreg.bat' . Or just double-click that
>> batch file in Windows explorer.
>>
>> -Dan
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
>>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm