Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28499 Discussions

USE ADVAPI32 functions in openAPI compiler

dajum
Novice
2,560 Views

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):


INTEGER TYPEK,I,NV,STATUS,REG,ILEN
CHARACTER*512 PATH,VALUE,KEY
REG = 0
TYPEK = 0
VALUE = ' '
Path = 'Software\OurKey\OurCODE\1.1' // CHAR(0)
I = RegOpenKeyEx(HKEY_LOCAL_MACHINE, PATH, 0, KEY_READ, LOC(REG))

0 Kudos
1 Solution
Barbara_P_Intel
Moderator
2,020 Views

The error reported here with ifx is fixed in the latest release, 2021.3.0. It was made available about a week ago.  Please give it a try!

 

>ifx test.for
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2021.3.0 Beta Build 20210619
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.25.28612.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:test.exe
-subsystem:console
test.obj

>test.exe
  daj out           2

Is the above the correct answer? 

 

View solution in original post

0 Kudos
13 Replies
dajum
Novice
2,536 Views

Attaching a test program that fails using IFX.

IFX @Test.txt

is how I compiled it but you can just use IFX test.for as well to get the message.

0 Kudos
andrew_4619
Honored Contributor II
2,528 Views

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.

0 Kudos
Steve_Lionel
Honored Contributor III
2,519 Views

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.

 
0 Kudos
Barbara_P_Intel
Moderator
2,503 Views

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

  • Support for 32-bit targets is deprecated in ifort and will be removed in a future release.

 

0 Kudos
Steve_Lionel
Honored Contributor III
2,495 Views

No, they are not 32-bit-only functions. The "32" in the name is an artifact. These functions are provided by advapi32.dll, a Windows system DLL.

0 Kudos
dajum
Novice
2,467 Views

Certainly the module ADVAPI32 is a Intel creation.  A bug in the IFX implementation for sure. 

0 Kudos
Steve_Lionel
Honored Contributor III
2,454 Views

There's nothing wrong with the module (originated with Microsoft). It's a simple ifx bug.

 
0 Kudos
dajum
Novice
2,439 Views

Question is how long do we have to wait for a fix? Maybe someone could post the fix?

0 Kudos
Steve_Lionel
Honored Contributor III
2,421 Views

@dajum , just use ifort and not ifx. 

 
0 Kudos
mecej4
Honored Contributor III
2,433 Views

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.

0 Kudos
Barbara_P_Intel
Moderator
2,419 Views

Thanks for the information about that "32".  I learned a bit more about Windows.  I'm more of a Linux person. 

0 Kudos
Barbara_P_Intel
Moderator
2,376 Views

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.

 

0 Kudos
Barbara_P_Intel
Moderator
2,021 Views

The error reported here with ifx is fixed in the latest release, 2021.3.0. It was made available about a week ago.  Please give it a try!

 

>ifx test.for
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2021.3.0 Beta Build 20210619
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.25.28612.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:test.exe
-subsystem:console
test.obj

>test.exe
  daj out           2

Is the above the correct answer? 

 

0 Kudos
Reply