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

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

Di_C_
Beginner
749 Views
The code: [fortran] !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 [/fortran] 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: [plain] 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 [/plain] dumpbin -exports foo.dll: [plain] 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 [/plain]
0 Kudos
5 Replies
Lorri_M_Intel
Employee
749 Views

Please try adding DECORATE to your DLLIMPORT macro as well.

              --Lorri

0 Kudos
Di_C_
Beginner
749 Views

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.

0 Kudos
Di_C_
Beginner
749 Views

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.

0 Kudos
Di_C_
Beginner
749 Views

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.

0 Kudos
Lorri_M_Intel
Employee
749 Views

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

             --Lorri

0 Kudos
Reply