Silverfrost Forums

Welcome to our forums

Problem with %cc + %ew

22 Sep 2016 2:24 #18022

Using both lines

    MA = WINIO@ ('%cc&', CB_EXIT)
    MA = WINIO@ ('%ew&', CB_EXIT)

my program provides after closing an error window with ' Attempt to call winio at program exit ' If I use only one of these lines - regardless which one - to program closes correct.

22 Sep 2016 4:36 #18023

Erwin,

You must retain the return path, otherwise MA (which I suspect is a local variable) may have disappeared.

The way to do this is to SAVE MA, or put it in a COMMON block. Global SAVEs work too ...

Eddie

26 Sep 2016 8:32 #18032

Erwin

Has this issue been resolved?

Here is my test program that runs within failure.

integer ma,winio@
integer,external::cb_exit
ma = winio@('%bt[OK]&')
ma = winio@('%cc&',cb_exit) 
ma = winio@('%ew',cb_exit)
end

integer function cb_exit()
cb_exit = 0
end
26 Sep 2016 8:55 #18033

Paul,

'within' failure? What does that mean?

Putting it in a main program means that the return path to MA isn't lost. If you spread your Clearwin+ WINIO@s across several routines, then you get the error.

Now how did I discover that? (Memory cogs whirr) Aha! You told me!

This is a clear example where the simplified test program works but the big program is liable to fail.

Eddie

26 Sep 2016 9:12 #18034

Eddie

'within' is just Monday morning typing for 'without'!

Do you have a short program that fails?

26 Sep 2016 10:15 #18035

Paul, I made a small example, but it works fine. If there is no %ew, the user has to close the program before shutting down. That's my solution now.

For the know-all: MA is in a module.

26 Sep 2016 10:49 #18036

Paul,

I can't get a short program to fail, nor can I find the original forum post where you provided the helpful advice.

My program first affected works with global SAVE, and not without, later programs reflect the knowledge gained and only save the WINIO@ return variable (and they work too). I haven't tried it with a module.

As for Erwin's solution, you can always make things work by taking out the bits that cause you bother, but it doesn't help when the user shuts down windows at the end of a long day before saving their data, I know that much

Eddie.

Please login to reply.