Accessing Fortran Modules within a Fortran library from Fortran

  • Thread starter LLopes
  • Start date
5
0
Yes, a lot of FORTRAN, but here goes.
I am very new to creating libraries so give me some credit.
I have a main fortran code which calls a library.

LibraryCode.f90

program LibraryCode
implicit none

character(len=4)::string

string = 'here'
print*, string
call LibraryCall(string)
pause
end program LibraryCode


and in my library i have the subroutine

Library.f90

subroutine LibraryCall(string)
!DEC$ ATTRIBUTES DLLEXPORT::LibraryCall
character(len=4)::string

print*, string
end subroutine LibraryCall


I can compile this just fine, it creates the dll and I can access it from the LibraryCode.f90 just fine. However, I need to wrap this in a module, i.e.

module Library

subroutine LibraryCall(string)
!DEC$ ATTRIBUTES DLLEXPORT::LibraryCall
character(len=4)::string

print*, string
end subroutine LibraryCall

end module Library


When I don't have the module there everything works fine, but when I do, I get unresolved external. I also have several functions and files. Most of them are just function calls. Some of them use the module I would like to add therefore I know it's compiled into the dll, however I cannot access the parameters in the module directly. I have tried using things like

module Library
!DEC$ ATTRIBUTES DLLEXPORT::Library


but the compiler just tells me this is useless and it doesn't find the module's data.


Any help or clarification needed and I would be willing to provide it.
 

Want to reply to this thread?

"Accessing Fortran Modules within a Fortran library from Fortran" You must log in or register to reply here.

Related Threads for: Accessing Fortran Modules within a Fortran library from Fortran

  • Posted
Replies
0
Views
2K
Replies
0
Views
3K
Replies
0
Views
4K
  • Posted
Replies
0
Views
1K
  • Posted
Replies
0
Views
2K
  • Posted
Replies
0
Views
3K
Replies
0
Views
2K

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top