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

Discussion of Intel Visual Fortran samples

Steven_L_Intel1
Employee
2,768 Views

Please use this thread for discussion of and asking questions about the samples I posted.

0 Kudos
35 Replies
gkchang
Beginner
1,973 Views

Hi Steve,

I have a quick question on the following sample file:

ExceptionHandlingGETEPTR

When compiling the solution, I've got the following error:

fatal error LNK 1104" cannot open file 'IFWIN.LIB'

Please advise how to add this reference tothe C project of the solution (though it already has the dependency to the geteptr_lib). TIA

-George

0 Kudos
Steven_L_Intel1
Employee
1,973 Views
Tools..Options..Projects..VC++ Directories. To the list of Library directories add C:Program FilesIntelCompilerFortran9.0IA32Lib

You have to do this in general when building C applications that call Fortran code.
0 Kudos
guy_houlsby
Beginner
1,973 Views

I am running Visual Studio 2005 and IVF 9.1 and have a problem with running a Fortran dll from Visual Basic.

I have taken your example, which runs fine. However, if I add the following code to the fortran I get a problem:

SUBROUTINE dll_rout1 ()

IMPLICIT NONE

!DEC$ ATTRIBUTES DLLEXPORT, STDCALL :: dll_rout1

!DEC$ ATTRIBUTES ALIAS:'dll_rout1' :: dll_rout1

character(len=4) :: dd

dd="aaa"

RETURN

END

Note that I leave your code exactly intact - my code is an additional routine that is never executed. When I press the "Do it!" button in your code I get the error:

"BadImageFormatException was unhandled"

"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

What is very odd is that if I change "aaa" to "aaaa" in the above code then everything works fine! It seems to be someting to do with the presence of a string that is not the "right" length, but Fortran of course should cope with that. Any suggestions? ... I'd be very interested to know if your system reproduces this fault!

0 Kudos
guy_houlsby
Beginner
1,973 Views
I posted a question about the samples here, and it appeared for a short while and then disappeared again. How do I get a reply? (Please be patient with a novice to this game).
0 Kudos
Steven_L_Intel1
Employee
1,973 Views
I sent you email about it.
0 Kudos
warwickb
Beginner
1,973 Views
I have tried building the 'C_calls_Fortran' solution in Debug mode and everything links OK but on "Debug...Starting New Instance" for USEDLL I get the message that MSVCRTD.DLL is not found. I searched through the Microsoft Visual Studio 2003.NET directories and couldn't find it there but I could find MSVCRTD.LIB.

Note that the USELIB version worked fine. Note that just building USEDLL alone also has the same result as before.

Just wondering how serious this is if I want to use USEDLL as a template for calling a FORTRAN DLL I've created?
Regards, Warwick
0 Kudos
Steven_L_Intel1
Employee
1,973 Views
You're using an old version of the compiler. As in at least a year and a half old. If you can't get a newer one, go to the Fortran..Libraries property page and choose "Single-Threaded DLL" for "Use Run-Time Library", not "Debug Single-Threaded DLL".

The problem was that the Fortran debug DLL libraries were linked to a non-redistributable MSVC 6 DLL. They aren't anymore.
0 Kudos
warwickb
Beginner
1,973 Views
Hi,
Despite having an old compiler I have managed to get something working involving the Mixed-Language examples. Your example uses a mainline C++ program to call the FORTRAN DLL. Oracle seems to require me to call a FORTRAN routine from a C (not C++) DLL. I have tried to use the Microsoft Visual Studio wizard to create a C DLL that calls FSUB but it won't compile with the call to printf:
"error C3861: 'printf': identifier not found, even with argument-dependent lookup". Interestingly I had a similar problem previously but I got around it substituting " for and > (I think) in the #include "*.h" commands. My code is attached along with the complete error message.

I probably should be asking ORACLE for help but others may be interested in knowing how to call a FORTRAN subroutine - or DLL - from a C DLL. I'm using Visual C++ associated with Visual Studio 2003 .NET.

I got rid of printf and although it will compile, it won't create a .dll file:
"Linking...
Creating library Debug/C_DLL_CALLDLL.lib and object Debug/C_DLL_CALLDLL.exp
C_DLL_CALLDLL.obj : error LNK2019: unresolved external symbol __imp__FSUB referenced in function _CALL_FSUB
Debug/C_DLL_CALLDLL.dll : fatal error LNK1120: 1 unresolved externals"
even though I have put FDLL.lib and FDLL.dll files into the C_DLL_CALLDLL debug directory.

Regards, Warwick.
0 Kudos
Steven_L_Intel1
Employee
1,973 Views
There is not a real difference between C and C++ in this context, other than that if you are using C++ you must take care to avoid "name mangling". Your printf error is caused likely by not including stdio.h. The DLL export library must be either added to the C project or the DLL project must be a dependent of the C project.
0 Kudos
mhadian
Beginner
1,973 Views
Hi Steve
i tried to compile the c_calls_fortran project. i want to use fortran dll in c++ project.
the FDLL project compiles without any problem and makes .lib and .dll files. however USEDLL project fails with these warning and errors:
Warning 1 warning C4996: 'strcpy' was declared deprecated d:c_calls_fortrancmain.cpp 56
Error 2 error LNK2019: unresolved external symbol __imp__FSUB referenced in function _main CMAIN.obj
Error 3 fatal error LNK1120: 1 unresolved externals d:C_calls_FortranUSEDLLDebugUSEDLL.exe 1

i use Intel Visual Fortran 9.1 integrated with Visual Studio 2005.
i tried to add the .lib file to USEDLL project (as i do it for using dll's in fortran) but it did not solve the problem.

0 Kudos
Steven_L_Intel1
Employee
1,973 Views

The warning is a new thing in Visual C++ 8 (VS2005) - you can ignore it unless you want to research what new routine is to replace strcpy.

I am not sure what you did for the library issue, as adding the library works for me. Try adding it to the project itself rasther than to "source files". An alternative is to name the path to the library in the Linker Input property for Additional Dependencies.

0 Kudos
vivekrao4
Beginner
1,973 Views

When I try to download the samples by clicking on the zipped attachement, I get a message

The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------

An invalid character was found in text content. Error processing resource 'http://softwarecommunity.intel.com/isn/Community...

0 Kudos
Steven_L_Intel1
Employee
1,973 Views
Worked ok for me just now. If you still have a problem, let me know.
0 Kudos
vivekrao4
Beginner
1,973 Views

I am able to download the zip file using Firefox at work and at home but am not able to download it using Internet Explorer 6.0.2900 at work, running Windows XP Pro. My problem is solved, anyway. Thanks.

Vivek Rao

0 Kudos
dan_trowbridge
Beginner
1,973 Views
Steve,
I am trying to build a mixed language (c++ & FORTRAN) code that I had working about a year ago with a previous version of Intel's FORTRAN compiler (v8 I think). ( I am now using Visual Studio 2003 and Intel's FORTRAN 10.1.011). I build a FORTRAN dll and call it from c++. I can get the code to build but I get a run-time error (pop-up window) that says "The procedure entry point __cpowq could not be located in the dynamic link library libmmd.dll". So I tried to run your sample C_calls_Fortran. Visual studio had to converted the solution and projects to V10. All projects compiled fine but when I run the USEDLL code I get the same error as I get with my code. Is something wrong with my install? Did something in the projects not get converted correctly.

I looked in the "libmmd.lib" file and I find what looks like a reference to "___cpowq". The case matches but it looks like it has an extra leading underscore. Any help would be greatly appreciated.

Thanks
Dan

0 Kudos
dan_trowbridge
Beginner
1,973 Views
Steve,

Never mind, I found the problem. It so happens that Roxio (the CD burning code) had in its distribution a library by the same name and its directory appeared earlier in the search path than the FORTRAN compiler's library. I still don't get the triple undersore thing but since the code is working I guess I am not going to worry about it. (I also noticed some versions of routines in the .lib file that had a "_imp_" prepended to the name. I guess these are some kind of naming conventions.)

Bottom line is that is was a problem in finding the right library and it is now fixed.

Thanks anyway.
Dan

0 Kudos
Steven_L_Intel1
Employee
1,973 Views
__imp_ means that the symbol is imported from a DLL's import library.
0 Kudos
Svein-Atle_Engeseth
1,973 Views
Hi,
I tried to run the FXPLORER sample. Compilation went well, but when I started the program the message can't find IFDLGnnn.DLL appeared. I searched for such files and found one, IFDLG100.DLL, located in the compiler's bin directory. I use version 10.1.011 of the compiler. Any idea of how to solve this?
SAE
0 Kudos
Steven_L_Intel1
Employee
1,973 Views
Argh. Copy that DLL into the compiler's LIB folder. It is supposed to be in both but it isn't. I'll get that fixed.
0 Kudos
Svein-Atle_Engeseth
1,874 Views
Hi Steve, I have done as you said, but it still doesn't work. I rebuilt the solution, done in the IDE. The message is that the DLL is missing or not registered. Same as before. Does the ifort.cfg have anything to say in this? I don't use the original one. SAE
0 Kudos
Reply