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

Linker selection problem

David_J_2
Beginner
1,058 Views

I have a source that I can compile and execute and link using v9.0 using batch files in the 32bit cmd window environment. However, when I try and compile and link from inside an executable I get a strange problem. It tries to set the environment up but it must be missing something. We issue the command "IFORT @INFON.LNK" with all of the compile and link commands in the file INFON.LNK. But the output we get from the compiler is:

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

-out:astap.exe
-subsystem:console
-entry:mainCRTStartup
/LIBPATH:C:\PROGRA~1\CULLIM~1\SI72BD~1\lib
C:\PROGRA~1\CULLIM~1\SI72BD~1\lib\proces.lib
C:\PROGRA~1\CULLIM~1\SI72BD~1\lib\utility.lib
C:\PROGRA~1\CULLIM~1\SI72BD~1\lib\tdsubproc.lib
C:\PROGRA~1\CULLIM~1\SI72BD~1\lib\statwin.lib
C:\PROGRA~1\CULLIM~1\SI72BD~1\lib\sfmatlab.lib
C:\PROGRA~1\CULLIM~1\SI72BD~1\lib\isight.lib
/STACK:1000000000
/MAP
/NODEFAULTLIB:msvcrt.lib
/NODEFAULTLIB:dfordll.lib
/NODEFAULTLIB:msvcrtd.lib
/NODEFAULTLIB:dfor.lib
astap.obj
libifcorert.lib(libifcoremain.obj) : warning LNK4217: locally defined symbol __controlfp imported in function _testFPIEEE_RECORD
Intel Fortran Compiler for 32-bit applications, Version 9.0 Build 20060222Z Package ID: W_FC_C_9.0.030
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.
ifort -Qvc8 "-Qlocation,link,C:\Program Files\Microsoft Visual Studio 8\VC\Bin" astap.for /fpe:0 /names:lowercase /iface:cref /module:C:\PROGRA~1\CULLIM~1\SI72BD~1\lib /MT /libs:dll /iface:mixed_str_len_arg /include:C:\PROGRA~1\CULLIM~1\SI72BD~1\lib /assume:byterecl /extend_source:132 /O3 /list /traceback /INCREMENTAL:NO

The bad part I think is that it adds "-Qvc8" in the stream since I also have VS2005 installed. The linker doesn't issue any error messages. But the executable stops running when it gets to a call statstart which comes from our STATWIN.DLL. If I look in the map file there, is no listing for _statstart. While in the map from the execution in the cmd window it appears. There is an entry in both map files for __imp__statstart. So I don't understand why the linker doesn't give an error and seems to fail to find this routine in the DLL.

I'm not sure how to best fix this issue. It seems we don't want -Qvc8, but just adding -Qvc7.1 to the compile and link file gets a warning that it is overridding -Qvc8 with -Qvc7.1, but doesn't change the resulting executable. And it still doesn't run.

Thanks for any help.

Dave

0 Kudos
5 Replies
Steven_L_Intel1
Employee
1,058 Views

The -Qvc8 is not relevant. You are using the VS2005 linker. The only thing that this changes is the choice of MSVC libraries being used. If you want to use VS2003 instead, edit ifortvars.bat in the compiler "bin" folder to change the VS version that is used and edit ifort.cfg (same place) to specify -Qvc7.1 instead of -Qvc8.

The __imp_ symbol is correct for a DLL import library.

What, exactly and completely, is the error message?

0 Kudos
David_J_2
Beginner
1,058 Views
Steve,
There is no error message. The executable just hangs. It isn't running, but it doesn't crash. I put print statements before and after the call. The first gets output, the second doesn't. The routine is supposed to start a thread and open a window. That doesn't happen. But then that routine isn't listed in the .map file. I understand that the __imp__ should be there too, but why is the routine itself not there. There are also other routines that should be called that are not in the .map either.
We are not using a command window to execute this, but from within another application. I'm not sure how ifortvars would get executed, but we wouldn't be able to edit this reliably on our customers machines. We have been doing this for years so I'm not sure why it is different now. Can we get it to use VS2003 another way? Or should the VS2005 linker work correctly withV9.0?
Dave

0 Kudos
Steven_L_Intel1
Employee
1,058 Views

My recollection is that 9.0 did not support VS2005. I'm not sure how you ended up with that combination. But the linking is working fine so I would not waste time on that path.

The program hanging is not going to be a VS2005 vs. VS2003 issue, but if you want to test that, you'll either need to edit the files as I mentioned or reinstall 9.0 and specify that it should integrate with VS2003 (it asks.)

I would suggest some debugging is in order.

0 Kudos
David_J_2
Beginner
1,058 Views
Steve,
It turns out that the switch /STACK:1000000000 was causing it to link strangely. I changed it to /STACK:100000000
and then all my missing routines show up in the .map file. _statstart was in the .map only with the lower stack size.
Any explanation?
Dave

0 Kudos
Steven_L_Intel1
Employee
1,058 Views

I guess the linker misbehaves with a stack reserve size close to 1GB. Glad to hear you solved it. May I suggest using /heap-arrays or ALLOCATABLE local arrays so that you don't need such a large stack?

0 Kudos
Reply