Hi all,
I was trying to call a natural sub program (which has some array parameters) from C# . Every time I call the subprogram - my application crashes and shows the following error :
Exception of type ‘SoftwareAG.EntireX.NETWrapper.Runtime.XException’ was thrown
I am giving my Natural IDL below
Program ‘X_HEADS’ Is
Define Data Parameter
1 HEAD_CODE               (N2/99)
1 HEAD_NAME               (A60/99)
1 HEAD_ACT                (A1/99)
End-Define
I changed the parameters in My Workbench only out
Program ‘X_HEADS’ Is
Define Data Parameter
1 HEAD_CODE 	(N2/99) 	Out
	1 HEAD_NAME 	(A60/99) 	Out
	1 HEAD_ACT 	(A1/99) 	Out
End-Define
My C# Stab is given below
[color=“blue”]#region * * * P L E A S E   D O   N O T   M O D I F Y * * *
/***************************************************************************
** Module name   : x_heads.cs
** Description   : Client Stub File for .NET (7.2.1.50)
**
**                 * * *  P L E A S E   D O   N O T   M O D I F Y  * * *
**
** Author        : Generated by Software AG EntireX IDL Compiler
** Template      : csharp_client.tpl for C#
** Platform      : .NET-able Platforms
** Usage         : 
#region AssemblyInfo
#if USE_ASSEMBLY_INFO
using System.Reflection ;
[assembly: AssemblyTitle(“EntireX .NET Wrapper Client”)]
[assembly: AssemblyDescription(“EntireX .NET Wrapper Client”)]
[assembly: AssemblyConfiguration(“”)]
[assembly: AssemblyCompany(“Software AG”)]
[assembly: AssemblyProduct(“EntireX Communicator”)]
[assembly: AssemblyCopyright(“”)]
[assembly: AssemblyTrademark(“”)]
[assembly: AssemblyCulture(“”)]
[assembly: AssemblyVersion(“1.0.*”)]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile(“”)]
[assembly: AssemblyKeyName(“”)]
#endif
#endregion
namespace Test.Lib.x_heads
{
[EntireXVersion(“7.2.1.50”)]
[Library(“ENTIRE_X”)]
[Broker(“ETB175”)]
[Service(“RPC/SRV1/CALLNAT”)]
public class ENTIRE_X : ServiceHolder
{
#region 	Constructor(s) etc for LIBRARY ‘ENTIRE_X’
public ENTIRE_X() : base() {}
public ENTIRE_X(Broker broker) : base ( broker ) {}
public ENTIRE_X(Service service) : base ( service ) {}
#endregion
#region Method/Function for LIBRARY ‘ENTIRE_X’ PROGRAM ‘X_HEADS’
[Program("X_HEADS")]
public void X_HEADS(
  [SendAs(IdlType.N, preDecimal=2, postDecimal=0, Dim=99f)][Out] out decimal[] HEAD_CODE,
  [SendAs(IdlType.A, Length=60f, Dim=99f, Trim=true)][Out] out string[] HEAD_NAME,
  [SendAs(IdlType.A1, Length=1f, Dim=99f)][Out] out char[] HEAD_ACT
)
{
  HEAD_CODE = new decimal[99];
  HEAD_NAME = new string[99] ;
  HEAD_ACT = new char[99] ;
  service.Send
   (
    this.GetType().GetMethod("X_HEADS"),
    HEAD_CODE,
    HEAD_NAME,
    HEAD_ACT
  );
}
#endregion
}
}
[/color]
My Client Application code is given below
        Test.Lib.x_heads.ENTIRE_X et = new Test.Lib.x_heads.ENTIRE_X();
        decimal[] a = new decimal[99];
        string[] b = new string[99];
        char[] c = new char[99];
       et.X_HEADS(out a, out b, out c);
       foreach (String  y in b)
           Console.WriteLine(y);
       
        Console.ReadLine();
I have been trying to make use of arrays of natural for a long time in .Net. however, I was never successful.
I would really appreciate if there is anyone to assist me. Other issue is it possible to consume a collection of class from natural to C# ?
looking forward for reply…
Moshtaq
Consultant, Government of Swaziland.