fortran invoking fortran dll LNK2019 problem on win7 64bit, decorate does not work

fortran invoking fortran dll LNK2019 problem on win7 64bit, decorate does not work

The code:


!foo.for

#define DLLIMPORT(name) _EXCLAMATIONDEC attributes dllimport,alias:#name::name

#define DLLEXPORT(name) _EXCLAMATIONDEC attributes dllexport,DECORATE,alias:#name::name 
      subroutine FOO()

      DLLEXPORT(FOO)

      end
!main.for

#define DLLIMPORT(name) _EXCLAMATIONDEC attributes dllimport,alias:#name::name

#define DLLEXPORT(name) _EXCLAMATIONDEC attributes dllexport,DECORATE,alias:#name::name 
      program main

      DLLIMPORT(FOO)

      call FOO

      end

compiled with ivf 2013 running on ia 32 with vs 2010.
the os is win7 64bit
it is compiled with option below to generate exclamation mark:
/fpp /D_EXCLAMATIONDEC=!DEC$

but when link an error occured:
error LNK2019: __imp__FOO

dumpbin -exports foo.lib:


File Type: LIBRARY
     Exports
       ordinal    name
                  _FOO
  Summary
          C0 .debug$S

          14 .idata$2

          14 .idata$3

           4 .idata$4

           4 .idata$5

           C .idata$6


dumpbin -exports foo.dll:

File Type: DLL
  Section contains the following exports for foo.dll
    00000000 characteristics

    53008ECE time date stamp Sun Feb 16 18:11:26 2014

        0.00 version

           1 ordinal base

           1 number of functions

           1 number of names
    ordinal hint RVA      name
          1    0 00001000 FOO
  Summary
        2000 .data

        2000 .rdata

        1000 .reloc

        5000 .text

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Please try adding DECORATE to your DLLIMPORT macro as well.

              --Lorri

Quote:

Lorri Menard (Intel) wrote:

Please try adding DECORATE to your DLLIMPORT macro as well.

              --Lorri

Dear Lorri:

Thansk a lot!

I've tried that, but the compiler says the DECORATE is conflict with DLLIMPORT.

Finally, I found the problem is caused by that I changed the target from win32 to x64, but I did not change the *.lib file the linker used... the path to the new *.lib is ./x64/Release rather than ./Release.

I should use less fixed path strings.

-Di.C.

Quote:

Lorri Menard (Intel) wrote:

Please try adding DECORATE to your DLLIMPORT macro as well.

              --Lorri

Dear Lorri:

Thansk a lot!

I've tried that, but the compiler says the DECORATE is conflict with DLLIMPORT.

Finally, I found the problem is caused by that I changed the target from win32 to x64, but I did not change the *.lib file the linker used... the path to the new *.lib is ./x64/Release rather than ./Release.

I should use less fixed path strings.

-Di.C.

Quote:

Lorri Menard (Intel) wrote:

Please try adding DECORATE to your DLLIMPORT macro as well.

              --Lorri

Dear Lorri:

Thansk a lot!

I've tried that, but the compiler says the DECORATE is conflict with DLLIMPORT.

Finally, I found the problem is caused by that I changed the target from win32 to x64, but I did not change the *.lib file the linker used... the path to the new *.lib is ./x64/Release rather than ./Release.

I should use less fixed path strings.

-Di.C.

:-)  I'm glad to hear you've resolved the problem!

             --Lorri

Login to leave a comment.