[Freemint-list] shel_write() causing memory violation?

Miro Kropáček miro.kropacek at gmail.com
Sat Jan 7 17:58:56 MSK 2017


Guys,

apart from writing essays on pretty displays I do some programming, too. ;)
I'm trying to fix the last remaining bug (I know of) in TosWin2 and that is
a memory violation if TW2 is not started and a TTP/TOS is executed via
$TOSRUN.

It all boils down to this:

::::::::::::::
tmp1.c
::::::::::::::
#include <gem.h>
#include <stdio.h>

int main() {
   short id = shel_write(1, 1, 1, "c:\\tmp2.app", "");
   printf("ID: %d\n", id);
   return 0;
}

::::::::::::::
tmp2.c
::::::::::::::
#include <gem.h>
#include <osbind.h>

int main() {
   short id = appl_init();

   short Wchar, Hchar, Wbox, Hbox;
   short phys_handle = graf_handle (&Wchar, &Hchar, &Wbox, &Hbox);

   short handle = phys_handle;
   short work_out[57];
   short work_in[11] = {Getrez() + 2,1,1,1,1,1,1,1,1,1,2};
   v_opnvwk (work_in, &handle, work_out);

   v_clsvwk (handle);

   appl_exit();
   return 0;
}

If I run tmp2.app, everything is fine. But if I run tmp1.app (which
executes tmp2.app via shel_write()), I get a memory violation on the line
with v_opnvwk().

Do you have any idea why? Is it forbidden for some reason?

-- 
MiKRO / Mystic Bytes
http://mikro.atari.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.atariforge.org/pipermail/freemint-list/attachments/20170108/43bb8c5c/attachment.html 


More information about the Freemint-list mailing list