I am working on a program inversion 2108 of parallel fortran. The program has a main executable communicating with a dll. I used the information in the article "coding requirements for sharing data in DLL's".
I have a common named Reserves, and a subroutine call GetReserveFund. The following statement was added to the main program:
!Dec$ATTRIBUTE DLLEXPORT :: GETRESERVEFUND, /Reserves/
I then added this code the main program:
!Dec$ATTRIBUTE DLLIMPORT :: GETRESERVEFUND, /Reserves/
When I run the program I get the following run time error:
FortranTest.Exe - Entry Point Not Found.
The procedure entry point Reserves could not be located in the dynamic link library cfx_fortran_dll.dll.
I am trying to pass a common block, why does it think it is a procedure. I followed the documentation and I am not sure why it is not working.
You have misspelled the directive. It starts:
The lowercase is fine, but the keyword is incorrect and there must be a space after the $. Or maybe you're just typing this from memory and your actual program has something different - that makes it quite difficult to help you.
If you still need help, please post a minimal but complete example of the DLL source and EXE source so that we can see what you are actually trying. Snippets and paraphrases are rarely useful (and most often misleading.)
Here's an example that works:
!dll.f90 subroutine dllsub common /mycmn/ j !DEC$ ATTRIBUTES DLLEXPORT :: dllsub,/mycmn/ print *, j end subroutine dllsub
!main.f90 program test common /mycmn/ j !DEC$ ATTRIBUTES DLLIMPORT :: dllsub, /mycmn/ j = 42 call dllsub end program test
D:\Projects>ifort /dll dll.f90 D:\Projects>ifort main.f90 dll.lib D:\Projects>main.exe 42
Out of interest, I decided to test your example with my old VS2005/IVF11.075 combination (on Windows 7). The program builds, but when I execute it I get:
Runtime error! R6034 An application has made an attempt to load the C runtime library incorrectly.
Is this the result of changes since IVF11?
Gib, did you build the DLL and the EXE in VS2005? If so check that both targets/projects are built with /Release, or both with /Debug specified. Likewise, both targets should be 32-bit or 64-bit.
If you think that the reason is something else, please provide more details.
I just built Steve's example with CVF6.6c (dated 2003), and there were no problems.