|
Jon Paris wrote:
>
> >> Wouldn't an exported constant Variable have other attributes such as
> type, length, etc?
>
> Unless I'm mismembering, exported variables don't really have any attributes
> other than a name. It is up to the programmer to make sure the storage is
> mapped in the same way in the importer as it was in the exporter.
>
> According to the ILE Concepts manual, the length of strong exports has to be
> known at compile time. However, although RPG uses the strong export model,
> I see no evidence that length has any effect. A test module that exported a
> 30 character field was successfully imported into other modules as both a 20
> and as a 40 character field with no problems.
>
> It seems likely that exports like parms are "just a pointer" with no other
> special attributes.
>
I think (but don't know) that the actual storage is part of the
exporting module's static storage; the length of that would have to be
known at compile time. But indeed the length doesn't seem to be stored
as part of the export/import information for the module.
But export/import variables have attributes such as type and length in
exactly the same way that parameters passed by reference to. The system
knows nothing about the type and length; only the compiler knows. Of
course, the compiler only knows what the programmer tells it; similar to
only having prototypes coded in one place, you should only have
import/export variables coded in one place (/copy file) too.
D globalVar s 10a
/if defined(main)
D export inz('abc')
/else
D import
D ?const?
/endif
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.