xsharp.eu • Possibly error message when starting program with missing included DLL - Page 5
Page 5 of 5

Re: Possibly error message when starting program with missing included DLL

Posted: Wed Sep 11, 2024 11:16 am
by Chris
Hi Wolfgang,

Ah, thanks for sending the sample, I see what's causing the problem. It's because of the enabled /vo5 (implicit CLIPPER calling convention) compiler option, which makes all methods that have no parameters be emitted as CLIPPER calling convention methods, for compatibility with VO.

To fix this (if you don't want to keep the parameter arguments) without disabling /vo5, you need to add a STRICT clause to the Start() method definition.

Re: Possibly error message when starting program with missing included DLL

Posted: Wed Sep 11, 2024 11:38 am
by wriedmann
Hi Chris,
thank you very much for looking into it!
IMHO it is completely the same if I add the parameters or the strict modifier... it is only to know that some change is needed.
But there is a small difference between the Start() function in VO and X#: in VO it is untyped and returns nil, in X# it needs to be typed and must return an int.
I have to change that after every migration.
Wolfgang

Re: Possibly error message when starting program with missing included DLL

Posted: Wed Sep 11, 2024 12:49 pm
by Chris
Hi Wolfgang,

It can also return VOID in X#. But doesn't the VOXporter do the necessary change?

Re: Possibly error message when starting program with missing included DLL

Posted: Wed Sep 11, 2024 12:55 pm
by robert
Wolfgang,
Your code works very well.
I added the following to the Start() function and the error is caught and shown correctly

Code: Select all

 nExitCode := 1/nExitCode

Code: Select all


An unhandled exception has occurred
===================================
Exception: Attempted to divide by zero.
Callstack:
   at Functions.Start() in C:\XIDE\Projects\Default\Applications\StartupExceptionTester2\Prg\Start.prg:line 77
   at XStartupCode.Start() in C:\XIDE\Projects\Default\Applications\StartupExceptionTester2\Prg\Start.prg:line 18

===================================
Press Return to close the application

Robert

Re: Possibly error message when starting program with missing included DLL

Posted: Mon Sep 16, 2024 5:17 am
by wriedmann
Hi Robert, all,
I have documented that also here:
https://docs.xsharp.it/doku.php?id=code ... am_startup
So that it will not go lost over time.
If there is anything I should also add there please let me know.
Wolfgang

Re: Possibly error message when starting program with missing included DLL

Posted: Mon Sep 16, 2024 8:40 am
by Chris
Hi Wolfgang,

Your code looks great, except for a couple small problems:

1. You did not declare the Start() method as STRICT, so if the /vo5 compiler option is enabled in the app, then the compiler will not find this method (as we discussed earlier).
2. The preprocessor will translate Wait to _Wait() by default (unless you have disabled using the standard preprocessor directives with /nostddefs (in XIDE it's in the advanced page of the app properties), so you need to use a different name for this function. Or you can simply directly call Console.ReadLine() instead of calling an intermediate function.
3. The call to Functions.Start() is ambiguous. Instead you need to specify the full name, like AppName.Exe.Functions.Start(). Or rename the original Start() function so something like StartApp() and simply call StartApp() from inside XStartupCode.Start()

Re: Possibly error message when starting program with missing included DLL

Posted: Mon Sep 16, 2024 9:08 am
by wriedmann
Hi Chris,
you are right - I had mixed the samples (StartupExceptionTester is the Windows Forms sample, and StarupExceptionConsole is the VO dialect console program.
I will have to build a VO GUI sample later.
Wolfgang