This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: exporting symbols, help with export list


On Thu, Aug 05, 2004 at 01:00:44PM -0400, Robert Schweikert wrote:
> I have another question/problem with respect to the symbol exporting
> discussed earlier this week.
> 
> How does this work with Fortran common blocks?
> 
> The basic idea is as follows:
> 
> I have a common block in shared library A as well as some other code.
> The code and common block are exported in a version script like so:
> 
> {
>     global:
>         setcommon_;
>         cdp_;
>     local: *;
> };
> 
> where cdp is the common block declared as follows:
> 
> common/cdp/joutp
> 
> In shared library B I call setcommon_ which sets the value of the common
> block varaible. Then I read the value of the common block directly in B
> and if I use export lists the value is incorrect. When not using export
> lists the value is correct.
> 
> Attached is a simple example, and here is the output:
> 
> No export list
> 
> -> ./noExport.x
> Test common blocks with export lists
>  Value before setCommon:  0
>  Set the common block value to:  10
>  Value after setCommon:  10
>  Common value in readvales:  10
> 
> With export list
> 
> -> ./export.x
> Test common blocks with export lists
>  Value before setCommon:  0
>  Set the common block value to:  10
>  Value after setCommon:  0
>  Common value in readvales:  0
> 
> What is the trick to get the correct behavior when using export lists?
> 

Due to the nature of common blocks, a common block is "defined" in all
DSOs where it is used. You have to export the common block in all DSOs
where it is "defined". You can add

	cdp_;

to xportFort.tmp and you will be all set.


H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]