PB 3.2.PB/Vision 2.0 Timerinstallcode.Shared Arrays 
Author Message
 PB 3.2.PB/Vision 2.0 Timerinstallcode.Shared Arrays

Hi,

In a sub/function where I install a background task using PB/Vision's
TIMERINSTALLCODE CODESEG(myFunc),CODEPTR(myFunc) I also have DIMmed an
integer array as SHARED(DIM anArray(1:whatever) as SHARED INTEGER

In myFunc this array is shared as in SHARED myFunc().

Problem:
    myFunc does know of the existence of anArray.

Does anyone have any clue here?

Thanks for considering this message.

Tom



Mon, 24 May 2004 17:26:09 GMT  
 PB 3.2.PB/Vision 2.0 Timerinstallcode.Shared Arrays
Hi Tom,

It sounds more like a variable scope problem rather than anything to
do with the TimerInstallCode() function.

Assuming you DIMensioned the array in your "main" code, you won't need
a matching SHARED statement in the actual "myFunc" routine.  For
example:

$dim array
dim a(1:1) as shared string
a(1) = "Hello!"
call b

function b LOCAL
'  shared a() <- this is optional in this example - a() inherits
SHARED status
  print a(1)
end function

However, if the array is created as SHARED in another Sub/Function,
you'll need to explicitly declare it as SHARED in the other
Subs/Functions too.  For example:

$dim array
call c

function c LOCAL
  dim a(1:1) as shared string
  a(1) = "Hello!"
  call b
end function

function b LOCAL
  shared a() ' <- required for the array to be "seen"
  print a(1)
end function

I hope this helps!

Quote:

>Hi,

>In a sub/function where I install a background task using PB/Vision's
>TIMERINSTALLCODE CODESEG(myFunc),CODEPTR(myFunc) I also have DIMmed an
>integer array as SHARED(DIM anArray(1:whatever) as SHARED INTEGER

>In myFunc this array is shared as in SHARED myFunc().

>Problem:
>    myFunc does know of the existence of anArray.

>Does anyone have any clue here?

>Thanks for considering this message.

>Tom

Lance
powerbasic Support

-------------------------------------------------------------------------
PowerBASIC, Inc.      | 800-780-7707 Sales | "We put the Power in Basic!"
316 Mid Valley Center | 831-659-8000 Voice | http://www.powerbasic.com



Tue, 25 May 2004 22:09:12 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. MX Lookup with PB/CC or PB/DLL

2. TCPADDR for PB/DLL & PB/CC

3. Info on new PB/CC and PB/DLL

4. Announcing the JazzAge COM Wizard for PB/DLL and PB/CC

5. animated characters, speech input/output in PB/DLL and PB/CC

6. email enable PB/DLL-PB/CC using Outlook

7. SQL, ADO/OLE-DB programming in PB/DLL and PB/CC

8. PB Vision Bug?

9. setup program with PB/VISION

10. Pb loading a shared library under SunOs 4.1.3

11. JA COM/PB 2.0 release

12. need PB/DLL 2.0 dumb terminal source

 

 
Powered by phpBB® Forum Software