×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Fortran EXE Cannot Find Fortran DLL

Fortran EXE Cannot Find Fortran DLL

Fortran EXE Cannot Find Fortran DLL

(OP)
I'm using CVF and am trying to get the basics of creating a DLL down so I can go on and do something bigger. I can get both the DLL and the EXE to compile properly. However, when I try to execute the program, it won't execute because it can't find the DLL. Here is my code for the program inside the DLL:

PROGRAM retention
END

SUBROUTINE VISC (tk, viscosity)
!DEC$ ATTRIBUTES DLLEXPORT :: VISC
REAL tk, viscosity
viscosity=(1.e-6*(5.6159426 + 0.053286909*tk))/(1 + 0.0002676519*tk)
END SUBROUTINE

And the code for the EXE is:

PROGRAM main
!DEC$ ATTRIBUTES DLLEXPORT :: VISC
REAL viscosity, tk
READ *,tk
CALL VISC (tk, viscosity)
PRINT *,tk,viscosity
STOP
END

I've tried just about everything I can think of. Manually moving the DLL to either the project folder, the debug folder, or the release folder results in a DFORRTD.DLL error instead of a missing retention.DLL error. I attempted to put the executable in a subfolder directly under the folder where the DLL is with no luck.

The error message is:
This application has failed to start because retention.dll was not found. Re-installing the application may fix this problem.

There is probably something incredibly stupid that I'm missing, but I cannot figure out what it is. Each program was coded in it's own little project folder. When I tried importing the projects into the same workspace, the DLL would compile properly but the EXE would not. Any help would be greatly appreciated.

RE: Fortran EXE Cannot Find Fortran DLL

Try adding the DLL's directory to your PATH.

If you have "depends" which comes with Visual Studio, run that, giving the name of the executable.  It will tell you where it is looking for the DLLs and which ones it is picking up.  Similar to LDD on Unix.

RE: Fortran EXE Cannot Find Fortran DLL

first of all the declaration in your main program should be:
!DEC$ ATTRIBUTES DLLIMPORT :: VISC
secondly I think it is not necessary to create an empty program in your dll, you can include only exported functions and you need to add the import library created along with your dll to your EXE project to link them together (if not, you need to use the LoadLibrary and GetProcAddress to access to the dll). After successfull link, just put the dll and the executable in the same directory. This should work.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close