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

Need help building c calling fortran dll

heathatlas
Beginner
504 Views
I have compaq visual fortran and MS Visual Studio C/C++ 6.0. I am trying to build (in 1 project within the IDE) a dll where c code calls fortran objects. So far, I have been able to build a separate fortran dll and include this dll in the c project and get it to work. I would now like to place all of the files in one project.
Basically, I began a project as a c dll. Got the thing to build with all of the fortran code stubbed out. I then added the fortran code and no matter what I do, I now get the errror "Error spawning df.exe"
I have read the documentation and it all states this should be transparent to me. Ha! I have tried many settings and this is all I get. I think the crux of my problem is understanding how to make the IDE setting produce the following two scenarios.
1)How do I tell the IDE I want to compile the fortran code into objects which are then included and compiled by the c compiler.
2)Vice versa.
The only thing I could find in the literature was if I use the c compiler to link, then I have to use a fortran library included in my c. I tried that and nothing different.
Basically, all I want is a jab in the right direction or a simple example project where a dll is built via 1 c file and 1 fortran file where the c calls the fortran. The dll uses the multithread libraries but probably if I understood how to make even a single thread .exe with 1 mixed project I'd get it.
Thanks in advance! This seems like it should be a normal operation for compaq visual fortran.
0 Kudos
3 Replies
Steven_L_Intel1
Employee
504 Views
There's a provided example in the "mixlang" section of the sanples for "C_CALL_F". But the simple case is very simple- just create a project of the type appropriate for the main program (C or Fortran) and add the source files of both languages to the project and build. The appropriate compiler will be used.

It's a bit more complicated in Intel Visual Fortran, due to a change in design by Microsoft, but still fairly simple.
0 Kudos
Lorri_M_Intel
Employee
504 Views
The "error spawning df.exe" error often occurs if there is a configuration problem within DevStudio.
Please go to Tools-> Options -> Directories andlook at the values for "Showdirectories for executables". Is the directory
C:Program FilesMicrosoft Visual StudioDF98BIN
in that list?
If not, there may have been a problem during installation, and the Developer Studio information wasn't updated correctly.
Let me suggest re-installing CVF, and seeing if that helps.
Oh, you'll want to exit from DevStudio before doing the re-install, just in case.
- Lorri
0 Kudos
mmclark
Beginner
504 Views
I got this same error trying to after a new installation of Compaq Visual Fortran. Lorri's solution worked perfectly. I just added the directory to the executable file list under Tools--> Options--> Directories. After that the compiler worked fine. Thanks Lorri!
0 Kudos
Reply