[mvapich-discuss] Conflicting names for global variables

Krishna Kandalla kandalla at cse.ohio-state.edu
Wed Dec 12 22:20:56 EST 2012


Hi Adam,
        Thanks for letting us know. This array can be declared as
'static', as you suggested. Could you please let us know if the
following simple patch works for you?

Thanks,
Krishna

Index: src/mpi/coll/ch3_shmem_coll.c
===================================================================
--- src/mpi/coll/ch3_shmem_coll.c       (revision 5972)
+++ src/mpi/coll/ch3_shmem_coll.c       (working copy)
@@ -73,7 +73,7 @@
 int mv2_shmem_coll_size = 0;
 char *mv2_shmem_coll_file = NULL;

-char hostname[SHMEM_COLL_HOSTNAME_LEN];
+static char hostname[SHMEM_COLL_HOSTNAME_LEN];
 int my_rank;




On Wed, Dec 12, 2012 at 8:43 PM, Adam T. Moody <moody20 at llnl.gov> wrote:
> Hello MVAPICH Team,
> While working to port one application from MVAPICH to MVAPICH2, we
> immediately ran into a problem regarding common symbol names between the
> library and the application.  In particular, the "hostname" variable defined
> in ch3_shmem_coll.c conflicts with an application variable by the same name.
> The application linked ok, but then it seg faults at runtime.
>
> Since these variables are not meant to be exposed to applications, would you
> please modify the source to hide them?
>
> If those variables are only used internally within the same .c file, you can
> declare them as "static" so that they are not visible externally.
>
> For global variables that are needed outside of the .c file, you can add a
> prefix like "mv2_" to reduce the chance that the name will conflict with
> application variable names.
>
> Thanks,
> -Adam
> _______________________________________________
> mvapich-discuss mailing list
> mvapich-discuss at cse.ohio-state.edu
> http://mail.cse.ohio-state.edu/mailman/listinfo/mvapich-discuss


More information about the mvapich-discuss mailing list