Uniface User Forum

 View Only
  • 1.  Using Uniface from within .NET with ucall.dll

    Posted 9 days ago

    Today we are working with the COM objects from within .NET (version 4.6-4.8).
    Since customers are reporting some performance issues (where 'starting' the COM object suddenly takes 15 seconds and longer), we wanted to explore the possibility of using ucall directly with DllImport.

    However, we stumble upon issues and the documentation is actually not giving any details on this

    The call is currently
    UnifaceVM.UECREATE(1, IntPtr.Zero, "C:\Temp\uniface.asn /ini=C:\Temp\uniface.ini", "C:\Temp\uniface.asn", "", "C:\Temp", _environment)​

    However, when hitting the line, the application just crashes and stops. We can't find any log written anywhere at all. So, we adjusted the call to included the /log statement, specifying a path to write the logs to. And also specify the asn with the /asn options (both should work it seems, but they don't)
    UnifaceVM.UECREATE(1, IntPtr.Zero, "/asn=C:\Temp\unifacert.asn /ini=C:\Temp\unifacert.ini /log=C:\Temp\log.txt", "C:\Temp\uniface.asn", "", "C:\Temp", _environment)​

    We also tried any other option, like not specifying the INI file, not specifying the asn filename separately... but all with the same behaviour. In the system PATH variable, we included the uniface bin folder and this was necessary as without it, it actually threw an exception about not finding other files required. But once that issue was resolved, we keep on having crashes and nowhere a log file written.

    Anyone with some tips on this topic? We would really like to get this to work in order to do some tests on stability and performance.

    Nico Degraef
    Rocket Forum Shared Account

  • 2.  RE: Using Uniface from within .NET with ucall.dll

    Posted 5 days ago

    The Uniface 3GL functions are intended for C++ programs. I know that customer tried to use this stuff from .Net, but with varying results. First of all you need to be careful to use the correct data types for the bit-ness of Uniface (i.e. if it's 32- or 64-bit). I've seen people struggling with that.

    I've found a small C# sample program I have created some time ago - back when version 9.7 was still current - and when I compare that with your call then your command line does not look right. Here is a small excerpt from the code:

    static void Main(string[] args)
      Int32 hUniEnv = 0;

      string pathvar = System.Environment.GetEnvironmentVariable("PATH");
      System.Environment.SetEnvironmentVariable("PATH", @"C:\Program Files (x86)\Uniface\Uniface 9.7.01\common\bin;" + pathvar);
      System.Environment.SetEnvironmentVariable("USYSADM", @"C:\Program Files (x86)\Uniface\Uniface 9.7.01\uniface\adm");

      // Open a new UNIFACE environment
      UECREATE(1, 0, @"", @"c:\temp\test.asn", null, @"c:\temp", out hUniEnv);
      // ...

    But in case you get a crash then that usually means that there is a mismatch in the parameters. And probably do not get a log file since the crash occurs early on in the initialization of Uniface (before stuff like the log file handling is up-and-running).

    I hope this helps.

    Daniel Iseli
    Principal Technical Support Engineer
    Uniface Services
    Rocket Software, Switzerland