[comp.unix.aix] Accessing global variables from shared/dynmaic functions.

andy@ausvm1.iinus1.ibm.com (Andy Martin) (04/16/91)

If I have a global variable "global" declared in "main.c" and a module
"foo.o" which I want to be sharable/dynamically loadable how can I access  
"global" from within "foo.o"?

I can sort out the problems for external functions, but cannot find any way
for global varaibles I searched through all the documentation avaiable and the
only place it appears to mentions the exporting of static data is in the manual
page for loadbind ("... ImportaPointer or ExporPointer parameters may also be
set to any exported static data area symbol ...").

Any help would be much appreciated!


+------------------------------------------------------------------------+
| Andy Martin, Cooperating Compound Object Toolkit (CCOT).               |
| IBM Personal Systems Programming, 11400 Burnet Road, Austin, TX, 78759.|
| Office: 808/1K-014, Internal Zip: 3008, Phone: (512) 823-1801.         |
| Internet: amartin@ausvm1.vnet.ibm.com                                  |
|     VNET: AMARTIN at AUSVM1                                            |
|   Austin: andy@ruddles.austin.ibm.com                                  |
+------------------------------------------------------------------------+

prener@watson.ibm.com (Dan Prener) (04/19/91)

In article <6690@awdprime.UUCP>, andy@ausvm1.iinus1.ibm.com (Andy Martin) writes:
|> If I have a global variable "global" declared in "main.c" and a module
|> "foo.o" which I want to be sharable/dynamically loadable how can I access  
|> "global" from within "foo.o"?
|> 
|> I can sort out the problems for external functions, but cannot find any way
|> for global varaibles I searched through all the documentation avaiable and the
|> only place it appears to mentions the exporting of static data is in the manual
|> page for loadbind ("... ImportaPointer or ExporPointer parameters may also be
|> set to any exported static data area symbol ...").
|> 
|> Any help would be much appreciated!

You can import and export data the same way you import and export 
procedures.  What sort of difficulties have you run into?
-- 
                                   Dan Prener (prener @ watson.ibm.com)