Dan,
in this context I would like to remark that it might be worthwhile compiling the sources of your first entry (posted Mon Nov 18, 2019 5:43) with other compilers.
I modified both of your files a little (mainly substituting @ by $) in order to be appropriate to be compiled using INTEL's 64 bit compiler ifort.
I changed your second program to a file named module_test.for
MODULE MO
USE CLRWIN$
CHARACTER*128 PROGEXENAME, CMPROGNM$
INTEGER*2 N_ARGCOMM_LINE, CMNARGS$
END MODULE
PROGRAM AAA
USE MO
PROGEXENAME = CMPROGNM$()
N_ARGCOMM_LINE = CMNARGS$()
PRINT*, N_ARGCOMM_LINE, ' ', PROGEXENAME
PAUSE
END
. Compiling module_test.for via ifort resulted in error messages
Intel(R) Visual Fortran Intel(R) 64 Compiler Professional for applications runni
ng on Intel(R) 64, Version 11.1 Build 20101201 Package ID: w_cprof_p_11.1.072
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
module_test.for(8): error #6410: This name has not been declared as an array or
a function. [CMPROGNM$]
PROGEXENAME = CMPROGNM$()
--------------------^
module_test.for(8): error #6054: A CHARACTER data type is required in this conte
xt. [CMPROGNM$]
PROGEXENAME = CMPROGNM$()
--------------------^
module_test.for(9): error #6410: This name has not been declared as an array or
a function. [CMNARGS$]
N_ARGCOMM_LINE = CMNARGS$()
-----------------------^
compilation aborted for module_test.for (code 1)
Deactivating/commenting out lines
PROGEXENAME = CMPROGNM$()
N_ARGCOMM_LINE = CMNARGS$()
in file module_test.for and compiling it via ifort is successful and results in object file module_test.obj. Via command
dumpbin.exe module_test.obj /ALL
you may verify that string 'CMPROGNM$' occurs only once in file module_test.obj and this as string 'MO_mp_CMPROGNM$'. This corresponds to the notes of Paul and mecej4 concerning the mangling in the module.
Regards,
Dietmar