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

Mixed-language code from Windows to Linux

HKort
Beginner
403 Views
Hi,
I have written some Fortran routines that I call from C on the MS Windows OS. The Fortran code is compiled into a DLL and I specify "!DEC$ ATTRIBUTES DLLEXPORT::MYROUTINE" in the routine to be exported. To use this routine from C I specify "extern __declspec(dllimport) voidMYROUTINE (int *iyear, int *iday, int *ihour, int *imin, int *iout);" Can anyone tell me how I have to change this if I want to make this work using sharable object libraries on Linux with the Intel Fortran and C compilers?
Thanks,
Haje
0 Kudos
3 Replies
Steven_L_Intel1
Employee
403 Views
My understanding is that those directives/pragmas are not needed on Linux. Just treat it as if the code was being linked statically. It is a Windows abberation that special coding practices are needed to create or use shared libraries.
0 Kudos
HKort
Beginner
403 Views

Steve,

do I read you correct that I should

1) Delete the "!DEC$ ATTRIBUTES DLLEXPORT::MYROUTINE" from the Fortran code, and

2) Change the line "extern __declspec(dllimport) voidMYROUTINE (int *iyear, int *iday, int *ihour, int *imin, int *iout);" to "extern voidMYROUTINE (int *iyear, int *iday, int *ihour, int *imin, int *iout);"?

Thanks,

Haje

0 Kudos
Steven_L_Intel1
Employee
403 Views
Correct.
0 Kudos
Reply