compilation - How to access a PRIVATE PUBLIC interface in Fortran? -


i have following code:

subroutine test use mp, only: mp_bcast integer :: b = 0 logical :: ... call mp_bcast (a, b) end subroutine test 

the problem module mp goes follow:

module mp implicit none private  public :: mp_bcast ! interface mp_bcast   module procedure mp_bcast_i1, mp_bcast_r1, mp_bcast_c1, mp_bcast_l  ! etc end interface  subroutine mp_bcast_l(msg,source,gid)   implicit none   logical :: msg   integer, intent(in) :: source   integer, intent(in) :: gid end subroutine mp_bcast_l 

it private interface public. cannot modify module mp (belong software want interface to).

i use following makefile:

mods = ../../modules_mp/libmod.a prog : prog.o test.o $(ld) $(ldflags) -o prog.x $(mods) 

this way though access public interface in module libmod.a contains module 'mp'. not work , error:

test.f90(38): error #6285: there no matching specific subroutine generic subroutine call.   [mp_bcast]   call mp_bcast (a,b) -------^ 

what correct way proceed?

thank you,

samuel

if calling generic routine, compiler goes through specific routines find 1 matches type of arguments. if doesn't find one, error message get.

have close @ types a , b are, , see whether 1 of specific routines matches it.

updated due more information

the specific subroutine think matches has 3 dummy arguments (one logical, 2 integer), supplying 2 (logical , 1 integer).

note: below original answer, people commented on, i'll leave it.

maybe a of type real , b type integer, compiler search specific routine has 1 real , 1 integer, in order, , doesn't find one. in case, might necessary convert 1 of variables, so:

call mp_bcast(a, float(b)) 

note: writing:

module procedure mp_bcast_i1, mp_bcast_r1, mp_bcast_c1  ! etc 

i deduce _i1 might stand integer(kind=1), , forth, though don't think there such thing real(kind=1).


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -