You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Announcement
Collapse
No announcement yet.
[PB-DOS v3.5] Sharing an array with a procedure present in a unit, without passing it
I know you could share the address (and number of elements) as simple LONG/DWORDs and from that use an ABSOLUTE array.. but a REDIM would not be reflected back to the the underlying PB Array which is dimensioned on the main program... but that might be good enough for your requirements? (Especially if you updated a PUBLIC "element count" variable and REDIMed with PRESERVE the underlying array on return from the procedure in the PBU file).
[PB-DOS v3.5] Sharing an array with a procedure present in a unit, without passing it
[PB-DOS v3.5]
From the manual, on page 151, I summarize: to share variables present in the main body of the program, to share it with the code present in an external unit, it is necessary to insert (in the main body of the program) the keyword "PUBLIC" in front of the name of the variable to be shared in the external unit ... while in the external unit it is necessary to put the keyword "EXTERNAL" in front of the variable name (variable present in the main body of the program).
My question is: how do you can access and use, from inside a unit, an array present in the main body of the program?
(I want to create an array, shared with a unit without having to pass it as argument of the call to the procedure contained in the unit)
Thanks a lot to who can give me some indications <3
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: