BBC BASIC for Windows
« use of the static variables »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:46pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: use of the static variables  (Read 771 times)
yee
New Member
Image


member is offline

Avatar




PM


Posts: 4
xx use of the static variables
« Thread started on: Nov 15th, 2014, 12:08am »

Hi, there

I am intrigue by the static variable (A%-Z%) in BBC4W

- if I have 2 compiled bbc programs accesing them (A%-Z%) run separately,

- do they come from the same RAM memory space (as on the BBC micro)

- if not, are there any BBC4W variable that do?

- a simple basic way for 2 programs to "talk" ?
User IP Logged

Matt
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 210
xx Re: use of the static variables
« Reply #1 on: Nov 15th, 2014, 05:34am »

on Nov 15th, 2014, 12:08am, yee wrote:
- if I have 2 compiled bbc programs accesing them (A%-Z%) run separately,

The help explains a lot of this. Look under 'Variables' in the 'General Information' section, and 'CHAIN' under 'Keywords'

If the programs are running independently, the variable will be independent. However, if one program is CALLed or RUN from another, the static variables are not cleared and can be accessed.

Quote:
- do they come from the same RAM memory space (as on the BBC micro)

One thing I'm not sure about is that, running tests, I found that the location of the static variables and pseudo-variables - e.g. HIMEM - seems to be the same in two independent programs. I'm struggling to work out why they would be the same. I would have expected two independent programs to be working in two different areas of memory.

Quote:
- if not, are there any BBC4W variable that do?

Not with two independent programs.

Quote:
- a simple basic way for 2 programs to "talk"

One easy way is to store information in a disk file that can be accessed by both programs. (Remember, only one can access it at a time, so error handling is important here.)

I don't know if there is a way to use memory locations directly by two programs, or if Windows will lock the locations to the individual program. I would guess accessing 'unauthorised' memory would cause a protection fault.

Matt
User IP Logged

rtr2
Guest
xx Re: use of the static variables
« Reply #2 on: Nov 15th, 2014, 06:33am »

on Nov 15th, 2014, 05:34am, Matt wrote:
I would have expected two independent programs to be working in two different areas of memory.

They do, of course, but you need to distinguish between 'physical' memory addresses and 'virtual' memory addresses. Every process sees the same virtual address space, but the physical memory it occupies will be different.

Quote:
I don't know if there is a way to use memory locations directly by two programs

Shared memory? Yes indeed - in fact I am currently working on an application in which three programs, running as separate processes, share a data structure:

http://bb4w.wikispaces.com/Sharing+a+structure+between+processes

Richard.
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls