Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Accessing Fortran Modules within a Fortran library from Fortran

  1. Jul 12, 2008 #1
    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.
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: Accessing Fortran Modules within a Fortran library from Fortran
  1. Fortran FFT library (Replies: 2)

Loading...