(j3.2006) Alternative binding label without C interoperability?
Clune, Thomas L. GSFC-6101
thomas.l.clune
Thu Sep 29 08:59:58 EDT 2016
(
> On Sep 29, 2016, at 3:59 AM, Cohen Malcolm <malcolm at nag-j.co.jp> wrote:
>
>> If the entry name is for a module procedure, it's unlikely the program
>> will be able to guess how the compiler mangled it.
>
> A module procedure is not even required to have a binding name of any kind.
> Indeed, the NAG compiler on both VAX/VMS and OpenVMS did not produce global
> binding names for module procedures.
>
> Tom mentioned shared libraries, but did not explain clearly that he wanted
> to use dynamic loading to get at them. (I still don't understand what the
> problem really is!) Before we embark on solutions, we do need a good
> understanding of the problem.
>
>> "Not in portable standard Fortran."
>
> Absolutely, because dlsym and dlopen are not portable.
Not absolutely portable perhaps. But very widely portable in the HPC world. And I?m assuming there are analogous procedures for Windows and other ?exotic? OS?s.
>
> If you're willing to limit yourself to dlsym and dlopen, and willing to
> limit yourself to using interoperable procedures, it is easy enough to do
> already.
I would like to learn of it.
> Also, one can usually finesse the interoperability requirements by
> passing C_PTR instead, though if the desired argument list is long and
> complicated that could be tedious.
In this case it is a very short list, 2 arguments, of which one is just an integer. So quite possibly this will work. But I?m still curious what you had in mind in your first sentence.
> OTOH a long a complicated argument list
> is probably not such a great idea anyway, as you won't get any checking if
> you are loading something dynamically.
Agreed.
>
>> The nonportable
>> part has been the mangling of both external and module procedure names.
>
> Well, it would be easy enough to have a "BINDING_NAME()" intrinsic function,
> specifically to enable dynamic loading (we could even require dlsym/dlload
> to work if they are supported by the processor, by referencing the Posix
> standard). That would probably be ok for external procedures, but not for
> module procedures. For module procedures one could just have an external
> procedure that called the module procedure.
Yes - that would be acceptable. But I am a bit surprised by the restriction given that we can use BIND(C) for other module procedures.
>
> But I think we will need a lot more discussion to work out what is really
> needed.
Sure. And I?ll be the first to admit there may not be sufficient demand for this. It just seemed like the standard has completely provided solutions that surround my problem, but keep just missing something that works.
Cheers,
- Tom
>
> Cheers,
> --
> ........................Malcolm Cohen, Nihon NAG, Tokyo.
>
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3
More information about the J3
mailing list