Possibly error message when starting program with missing included DLL

Have some feedback and input to share?
Don't be shy and drop us a note. We want to hear from you and strive to make our site better and more user friendly for our guests and members a like.
User avatar
Chris
Posts: 5003
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

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

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

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

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 5003
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

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

Post by Chris »

Hi Wolfgang,

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

XSharp Development Team
chris(at)xsharp.eu
User avatar
robert
Posts: 4573
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

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

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

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

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 5003
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

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

Post 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()
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

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

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply