Re: Dynamic Memory Allocation in a Turnkeyed App

From: Bob Nash <BNash_at_smud.org>
Date: Wed, 19 Jan 2000 14:46:01 -0800

        Thanks, that fixed it!

        -----Original Message-----
        From: SF Talk [SMTP:sftalk_at_forth.com]
        Sent: Wednesday, January 19, 2000 1:59 PM
        To: SF Talk
        Subject: Re: Dynamic Memory Allocation in a Turnkeyed App

        Date: Wed, 19 Jan 2000 13:16:58 -0800
        From: "Rick VanNorman" <rick_at_pophost.com>
        Subject: Re: [sftalk] Dynamic Memory Allocation in a Turnkeyed App

>From: Bob Nash <BNash_at_smud.org>

        Bob,

>I am trying to allocate a buffer in a turnkeyed application at run
time.
>Static allocation works fine, but adds to the size of the .EXE (of
course).
>Can anyone tell me why the following doesn't work (it is based on
BuffIO.f)?
>Please ignore the lack of CATCH/THROW error handling :-) I assume
that I
>need to use ADDR or something, but all experiments in that
direction have
>failed.
>
>32768 constant #tbuf
>
>variable 'tbuf
>
>: //tbuf ( -) #tbuf allocate drop 'tbuf ! ;
>: tbuf// ( -) 'tbuf @ free drop 0 'tbuf ! ;
>
>:onenvload //tbuf ; \ why not :onsysload ? What is the
>difference?
>: onenvexit tbuf// ;
>
>: tbuf ( - adr) 'tbuf @ ;
>
>: /tbuf ( -) tbuf #tbuf erase ;

        Generic assumption: you are replacing the 'MAIN vector to generate
        a stand-alone application sans the SwiftForth console window.

        At first glance, the problem is the :ONENV... chain which only gets
        called during the interactive development environment load.
Application
        initialization should be done in the :ONSYS... chain.

        If this doesn't fix it, post again with a little more description of
        how the application is started up.

        Rick

.
Received on Wed Jan 19 2000 - 13:16:58 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.