DLL with FORTRAN example fails: pgi18ug-x86.pdf page 123

I use the 18.10 community edition of pgfortran to make the test example on p 123 of the users guide. This creates a DLL and a calling program. I can make the DLL in two steps as described in the example:

pgfortran -Bdynamic -c object1.f90
pgfortran -Mmakedll object1.obj -o obj1.dll

I only had to change the “f” extension “f90”, since the source is free format. However, when I try to build the main program:

pgfortran -Bdynamic -o prog1 prog1.f90 -defaultlib:obj1

I get nothing! pgfortran is busy for a few seconds, no warning, no error message, no obj-file, no exe-file. But I remember that it did work with the 18.4 version of the community edition. Interestingly, when I remove the line
"!DEC$ ATTRIBUTES DLLIMPORT :: sub1, /acommon/ "
from prog1.f90, it works!! Apparently the linker finds the required modules in the obj1.lib without the DLLIMPORT directive. But that this directive should cause the compiler to abort is strange. I can not even compile, i.e.

pgfortran -Bdynamic -c prog1.f90

also produces no output, no warnings, and no error messages. Is this a new feature, or am I doing something wrong?

Hi bdick12925,

Thanks for the report! I’ve recreated the error here and it does look like a compiler issue which first began in 18.7.

I have added a problem report (TPR#26715) and sent it on to our compiler engineers for further investigation.

As you note, the error is due to the DEC ATTRIBUTES DLLIMPORT directive in prog1.f90. Removing this directive will work around the build error but cause “adata” to be a local variable rather than use the DLLs “adata”, thus causing incorrect results. Unfortunately, I don’t have a work around for the issue.

Thanks again for bringing this issue to our attention and we’ll get it fixed as soon as we can.

-Mat

Thanks for the fast response. Too bad that the problem is not my fault and no workaround is available. Actually, if I could roll back to 18.4, it should work if the license is still valid. Do you think that is possible?

Hi bdick12925,

Do you still have 18.4 installed? If so, you should be able to still use it.
Different PGI versions are installed side-by-side so would still be there even after installing 18.10 unless you uninstalled it. The top level links to the PGI shell environments (like on your Desktop or the start menu) are replaced, so you may need run the shell “pgi.bat” by finding it under the file explorer.

Otherwise, you may need to reinstall.

If you need to download 18.4, send a note to PGI Customer Service (trs@pgroup.com) and we can send you instruction.

-Mat

Has the release of 19.1 fixed this issue? If so I can wait til 19.1 becomes the new community edition.

Thanks,

Chris

Hi Chris,

Sorry, doesn’t look like we’ve fix this as of yet. I’ve requested that we bump up the priority and see if we can get it corrected by 19.4, the next community edition. Not sure they be able to, but hopefully.

-Mat

I just received the message that 19.4 is available as new community edition. Has this issue been fixed in the meantime? If not, I have to stay with the “old” version 18.4
best regards,
Bernhard

Hi Bernhard,

Unfortunately, no, TPR#26715 did not make the cut for inclusion in 19.4. I’ve ask the compiler engineer manager if it’s priority can be bumped up.

-Mat

Dear Mat,
Since the next community edition 19.10 has been announced I would like to ask again about the bugfix. Until this is not resolved, I have to continue using the old version 18.4, the latest version that was working correctly.
best regards,
Bernhard

Hi Bernhard,

Yes, another user encountered the same error not long ago so I pinged our engineers again. Hoping it gets some attention now.

-Mat

Dear Mat,
too bad - so I still have to live with 18.4 ;-). Well, this version is working fine for me, and I will probably not need new features of later versions. However, the DLL feature is essential for me. Nevertheless, I would like to know when a corrected version is available. Is it possible to get a message when the problem has been solved?

with best regards,
Bernhard

Hi Bernhard,

The issue should be resolved with 20.1’s release.

Thanks, then I will have to wait for the next community edition. When will this be available?
best regards,
Bernhard

Hi Bernhard,

When will this be available?

Yes, everything got delayed once GTC was moved to a virtual event (see: https://www.nvidia.com/en-us/gtc/). Though, it shouldn’t be too much longer.

-Mat