fortran - Loading only one subroutine from module -


i have module in coded bunch of subroutines use. however, not every time need of them. is possible load 1 (or two...) subroutine module?

my interest in doing there 1 particular subroutine requires module work, if i'm not going use subroutine prefer avoid loading module.

here example of have

module mylibrary implicit none contains    subroutine proc1     print *, 'this proc1'   end subroutine proc1    subroutine proc2     use extramod     print *, 'this proc2'   end subroutine proc2  end module mylibrary 

i able load in main program proc1 only, wouldn't have load module extramod (actually don't want need file). in main program, tried option only seems work variables , not subroutines. here example of main file

program main       use mylibrary, : proc1   implicit none   call proc1   end program main 

when compile this, error "error in opening compiled module file. check include paths. [extramod]".

any thoughts?

what want not possible compiler, unless change source of mylibrary module no longer references extramod.

(the specifier can indeed limit identifiers module accessible in given scope, including identifiers procedures, not relevant underlying problem.)

note behaviour seeing, given source, compiler specific.

with compiler information stored in mod file (which compiler specific file used communicate information module place module used) results compiling module limited things declared in module. means in case module references module, compiler needs find mod file other module when original module used.

other compilers may make each mod file complete - storing both things declared in module , referenced other modules. reduces number of files need distributed, results in larger mod files.

if 2 subroutines independent of each other, can split source of mylibrary module two, , use part of split contains module need.

if entities in extramod not part of characteristics of proc2 (e.g. if use type defined in extramod type of arguments of proc2, entities in extramod being used part of characteristics), may able move definition of proc2 submodule. break dependence of mod file mylibrary on mod file extramod.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -