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

DLLEXPORT use in Intel Fortran within Modules

Mohammad_K_
Beginner
1,535 Views

Hello,

I want to export the subroutines in the generated DLL library. I am using the following statements in the module but when checking the DLL using dumpbin the subroutines, i find that no subroutine symbols are exported. What am I doing wrong?

MODULE moduleName
CONTAINS
SUBROUTINE Y(X,Z)

!DEC$ ATTRIBUTES DLLEXPORT,ALIAS:"DLL_Y" :: Y

....

END SUBROUTINE

SUBROUTINE Q(A,B)

!DEC$ ATTRIBUTES DLLEXPORT,ALIAS:"DLL_Q" :: Q

....

END SUBROUTINE

END MODULE

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,535 Views

Works ok for me - perhaps your actual code isn't exactly like what you paraphrased?

[plain]
E:\Projects>type t.f90
MODULE moduleName
CONTAINS
SUBROUTINE Y(X,Z)

!DEC$ ATTRIBUTES DLLEXPORT,ALIAS:"DLL_Y" :: Y

!....

END SUBROUTINE

SUBROUTINE Q(A,B)

!DEC$ ATTRIBUTES DLLEXPORT,ALIAS:"DLL_Q" :: Q

!....

END SUBROUTINE

END MODULE
E:\Projects>ifort /dll t.f90
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 13.1.2.190 Build 20130514
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

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

-out:t.dll
-dll
-implib:t.lib
t.obj
   Creating library t.lib and object t.exp

E:\Projects>dumpbin -exports t.dll
Microsoft (R) COFF/PE Dumper Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file t.dll

File Type: DLL

  Section contains the following exports for t.dll

    00000000 characteristics
    51E9CC43 time date stamp Fri Jul 19 19:31:15 2013
        0.00 version
           1 ordinal base
           2 number of functions
           2 number of names

    ordinal hint RVA      name

          1    0 00001020 DLL_Q
          2    1 00001010 DLL_Y

  Summary

        1000 .data
        1000 .rdata
        1000 .reloc
        1000 .text

E:\Projects>
[/plain]

0 Kudos
Mohammad_K_
Beginner
1,535 Views

Steve,

The code is not exactly like what I posted. One notable difference is that the project has two modules instead of one. Also I compiled from with MSVS 2012 IDE and not from command prompt. The otherthing is that you are using an export flag in dumpbin, so perhaps they are exported after all. Let me check and get back.

Thanks,

Mohammad

0 Kudos
Reply