class
関数をエクスポートする.NET DLLに次のものがありますInitialize()
。
public class Class1
{
public static Indicator a = null;
private static int k = 0;
[DllExport( "Add", CallingConvention = CallingConvention.StdCall )]
public static int Add( int left, int right )
{
k = k + 1;
return k;
}
[DllExport( "Initialize", CallingConvention = CallingConvention.StdCall )]
public static void OnStartUp1( )
{
try
{
Thread.CurrentThread.SetApartmentState( ApartmentState.STA );
a = new Indicator();
a.Init();
}
catch ( Exception e )
{
MessageBox.Show( e.ToString() );
}
}
}
外部の Windows フォーム .NET アプリケーションからこのメソッドを呼び出すと、このメソッドは機能し、Indicator 型によって作成されたフォームは応答し、読み込まれます。
しかし、MT4 ( MetaTrader Terminal 4 metatrader4 ) と呼ばれる別のアプリケーションから呼び出すと、読み込みがうまくいかず、反応が悪く、フリーズしたように見えます。