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

dllimport

vader1000
Beginner
504 Views
I am using CVF 6.6A on a P3/P4 win 2k/xp system. I have the F95 check enabled. the following dll imports don't work:

!DEC$ ATTRIBUTES STDCALL, ALIAS : '_MPI_SubmitPassword@12', DLLIMPORT :: MPI_SubmitPassword
!DEC$ ATTRIBUTES REFERENCE :: PasswType, Access

and generate these errors:
C:TempFORTRAN CRYPTOMARX_MPI.F90(157) : Warning: This directive is not standard F95.
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_MPI_SubmitPassword@12', DLLIMPORT :: MPI_SubmitPassword
------^
C:TempFORTRAN CRYPTOMARX_MPI.F90(166) : Warning: This directive is not standard F95.
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_MPI_ErasePassword@4', DLLIMPORT :: MPI_ErasePassword
----------^

What is the new format for these? it appears to not like ATTRIBUTES directive. Honesly, this scares me as to why it wouldn't support this now. I what is the new syntax/requirements to do what i need done?

Thanks.

Jeff
0 Kudos
4 Replies
Steven_L_Intel1
Employee
504 Views
Yes, the DLLIMPORT directives do work. The compiler correctly warns you that they are not standard Fortran 95, but they still function.

We choose to treat directives as if they were statement extensions for the purpose of standards checking because they alter the semantics of the program. You can think of directives as statements with a funny syntax.

My advice is to isolate the interface blocks with the directives in a module, which you then compile without standards checking enabled. Or, put up with the warnings.

Steve
0 Kudos
vader1000
Beginner
504 Views
So if i were to adhere 100% to Fortran 95, it is not possible to call .dll's?
0 Kudos
Jugoslav_Dujic
Valued Contributor II
504 Views
No reason to be worried about -- !DEC$ATTRIBUTES still work, but they've never been part of the Fortran standard and that's what compiler is saying. I'm not sure whether this was checked in earlier versions, but I feel it should be -- although a non-Compaq compiler will ignore them (since they appear as comments), without them semantics of the code will not be the same.

I recommend that you switch off F95 checking when working with mixed-language/dlls. I wish warnings for some stuff could be selectively added/removed :-(...
0 Kudos
Steven_L_Intel1
Employee
504 Views
Your program isn't 100% Fortran 95 because it is calling a DLL from another language. You can get away with not using DLLIMPORT when calling DLL routines, but it looks as if you still need the ALIAS attribute in your code.

As I suggested earlier, you should isolate your non-standard code to a module, so that the rest of the application can be checked for standard conformance.

Steve
0 Kudos
Reply