I have code that works fine in the last few version of the compiler. Using Intel(R) Fortran Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Build 20201112_000000
I get an error #5528: The REFERENCE attribute cannot be used with a passed length CHARACTER variable on this platform
Since I have USE ADVAPI32 that is where I expect the definitions to be found. How do I work around this error?
Code looks like (with lots removed for clarity):
REG = 0
TYPEK = 0
VALUE = ' '
Path = 'Software\OurKey\OurCODE\1.1' // CHAR(0)
I = RegOpenKeyEx(HKEY_LOCAL_MACHINE, PATH, 0, KEY_READ, LOC(REG))
If the Interface used by IFX is the same as the Classic compiler (please check that) then I would expect your code to work. One problem is those interfaces are as old as the hills an use all manner of cludgy extensions "ignore loc" , "allow null" but if intel updated them to work with modern fortran c interop then existing code would break. I would file a report on it, I think the error is an error. I use my own interface for the routine.
Your test program compiles and runs fine with ifort, which you said you used in the original post. I agree it fails with ifx, which is a beta compiler, and that's a bug, or more likely, a not-yet-implemented thing.
I may be way off base on this, but that "32" is jumping out at me. Are those 32 -bit functions?
ifx supports only 64-bit targets.
And for planning purposes according to the Fortran Release Notes under Support Deprecated
BarbaraP wrote: "I may be way off base on this, but that "32" is jumping out at me."
We are dealing with a well-known anomaly of Windows. On a 64-bit Windows system, the System32 directory contains 64-bit EXEs and DLLs, whereas the SysWOW64 directory contains 32-bit EXEs and DLLs. The modifier "32" was added to system file names when DOS/Windows made the transition from 16 bit to 32 bit in the 1990s.
This is the error I get
>ifx test.for Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2021.1.2 Beta Build 20201214 Copyright (C) 1985-2020 Intel Corporation. All rights reserved. test.for(11): error #5528: The REFERENCE attribute cannot be used with a passed length CHARACTER variable on this platform I = RegOpenKeyEx(HKEY_LOCAL_MACHINE, PATH, 0, KEY_READ, LOC(REG)) ----------------^ compilation aborted for test.for (code 1)
ifx does not yet recognize non-standard C-interoperability. This error has already been reported, CMPLRLLVM-25905.
I added your nice reproducer to the case. Thank you for that!
As Steve pointed out, it works just fine with ifort. You can mix and match .obj files from ifort and ifx.